package com.huatai.dataservice.panel.feign;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.huatai.dataservice.panel.common.constant.CommonConstant;
import com.huatai.dataservice.panel.common.query.ComQuery;
import com.huatai.dataservice.panel.common.utils.IpUtils;
import com.huatai.dataservice.panel.entity.*;
import com.huatai.dataservice.panel.panelModel.*;
import com.huatai.dataservice.panel.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

/**
 * @ClassName PanelController
 * @Description TODO
 * @Author luoxc
 * @Date 2023/7/31 14:06
 * @Version 1.0
 */
@Slf4j
@RestController
@RequestMapping("panel/feign")
@Api(tags = "dd静态接口", value = "dd中台静态接口")
public class PanelController implements PanelClient {

	@Autowired
	private ITbTrialInformationDdService iTbTrialInformationDdService;

	@Autowired
	private ITbUnderwaterPlatformInfoDdService iTbUnderwaterPlatformInfoDdService;

	@Autowired
	private ITbSystemTtageDdService iTbSystemTtageDdService;

	@Autowired
	private ITbVehicleInfoDdService iTbVehicleInfoDdService;

	@Autowired
	private ITbFillingEquipmentInfoDdService iTbFillingEquipmentInfoDdService;

	@Autowired
	private ITbFloatingCraneDdService iTbFloatingCraneDdService;

	@Autowired
	private ITbVideoDdService iTbVideoDdService;

	@Autowired
	private ITbAnchorDdService iTbAnchorDdService;

	@Autowired
	private ITbSystemTtagerecordDdService iTbSystemTtagerecordDdService;

	@Autowired
	private ITbRtGnrmcGpsDdService iTbRtGnrmcGpsDdService;

	@Autowired
	private ITbModelMotionDdService iTbModelMotionDdService;

	@Autowired
	private ITbRtAmcStatusDdService iTbRtAmcStatusDdService;

	@Autowired
	private ITbProductOperationDdService iTbProductOperationDdService;

	@Autowired
	private ITbConfigDdService iTbConfigDdService;

	@Autowired
	private ITbSystemMessageService iTbSystemMessageService;

	@Autowired
	private ITbSystemTtageCommandDdService iTbSystemTtageCommandDdService;

	/*@Autowired
	private TrialInfoService trialInfoService;

	@Autowired
	private PlayBackInfoHandler playBackInfoHandler;

	@Autowired
	private EnvSystemPressureHandler envSystemPressureHandler;

	@Autowired
	private EnvHandler envHandler;

	@Autowired
	private SupportSystemConsoleHandler supportSystemConsoleHandler;

	@Autowired
	private SecurityDeviceGpsHandler securityDeviceGpsHandler;

	@Autowired
	private EnvSystemWaveSpeHandler envSystemWaveSpeHandler;

	@Autowired
	private PlayBackTagHandler playBackTagHandler;*/

	SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");

//	@ApiOperation("实时回放-试验信息设置")
//	@PostMapping("setPlayBackClient")
//	public R setPlayBackClient(@RequestParam(value = "data.taskNumber") String taskNumber, HttpServletRequest request) {
//		return playBackInfoHandler.setPlayBackTrialInfo(taskNumber, request);
//	}
//
//
//	@ApiOperation("特效配置")
//	@PostMapping("getEffectConfig")
//	public R getEffectConfig() {
//		List infoList = trialInfoService.getEffectConfig();
//		return R.ok().put("data", infoList);
//	}
//
//	@ApiOperation("回放-根据试验ID获取指令列表")
//	@PostMapping("getInstructRecords")
//	public R getInstructRecords(@RequestParam(value = "data.trialId") String trialId) {
//		List instructRecords = playBackTagHandler.getInstructRecords(trialId);
//		return R.ok().put("data", instructRecords);
//	}
//
//	/**
//	 * 批量添加标签
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-批量添加标签")
//	@PostMapping("tagAddAll")
//	public R tagAdd(@RequestParam("data") AddTagForm forms) {
//		playBackTagHandler.tagAddAll(forms);
//		return R.ok();
//	}
//
//	/**
//	 * 标签列表 中台
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-标签列表")
//	@PostMapping("tagList")
//	public R tagAdd(@RequestParam(value = "data.trialId") String trialId) {
//		List tags = playBackTagHandler.getTag(trialId);
//		return R.ok().put("data", tags);
//	}
//
//	/**
//	 * 回放---标签 孪生
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-标签")
//	@PostMapping("playBackTag")
//	public Map<String, Object> playBackTag(@RequestParam(value = "data.trialId") String trialId) {
//		return playBackTagHandler.getTagData(trialId);
//	}
//
//	/**
//	 * 回放---温度特效
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-温度特效")
//	@PostMapping("temperPlayBack")
//	public Map<String, Object> temperPlayBack(@RequestParam(value = "data.trialId") String trialId) {
//		return supportSystemConsoleHandler.temperPlayBack(trialId);
//	}
//
//	/**
//	 * 回放---水流特效
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-水流特效")
//	@PostMapping("waterSpePlayBack")
//	public Map<String, Object> waterSpePlayBack(@RequestParam(value = "data.trialId") String trialId) {
//		return envSystemWaveSpeHandler.waterSpePlayBack(trialId);
//	}
//
//
//	/**
//	 * 回放---波浪特效
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-波浪特效")
//	@PostMapping("waveSpePlayBack")
//	public Map<String, Object> waveSpePlayBack(@RequestParam(value = "data.trialId") String trialId) {
//		return envSystemWaveSpeHandler.waveSpePlayBack(trialId);
//	}
//
//
//	/**
//	 * 回放---承载平台数据（折线图）
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-承载平台数据（折线图）")
//	@PostMapping("securityDeviceGpsPlayBack")
//	public Map<String, Object> securityDeviceGpsPlayBack(@RequestParam(value = "data.trialId") String trialId) {
//		return securityDeviceGpsHandler.securityDeviceGpsPlayBack(trialId);
//	}
//
//
//	/**
//	 * 回放---保障系统面板数据
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-保障系统面板数据")
//	@PostMapping("selectSupportPlayBack")
//	public Map<String, Object> selectSupportPlayBack(@RequestParam(value = "data.trialId") String trialId) {
//		return supportSystemConsoleHandler.supportSystemPlayBack(trialId);
//	}
//
//	/**
//	 * 回放---环境数据
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-环境数据")
//	@PostMapping("selectEnvPlayBack")
//	public Map<String, Object> selectEnvPlayBack(@RequestParam(value = "data.trialId") String trialId) {
//		return envHandler.getEnvPlayBack(trialId);
//	}
//
//	/**
//	 * 回放---水压特效
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-水压特效")
//	@PostMapping("selectPressurePlayBack")
//	public Map<String, Object> selectPressurePlayBack(@RequestParam(value = "data.trialId") String trialId) {
//		return envSystemPressureHandler.playBackpressureSpe(trialId);
//	}
//
//
//	/**
//	 * 回放---平台倾角曲线
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放---平台倾角曲线")
//	@PostMapping("platformAnglePlayBack")
//	public ResponseVo platformAnglePlayBack(@RequestParam(value = "data.trialId") String trialId) {
//		ResponseVo responseVo = new ResponseVo();
//		List<DataVo> dataVos = new ArrayList<>();
//		List<TbConfigDd> configDds = iTbConfigDdService
//			.list(new LambdaQueryWrapper<TbConfigDd>().eq(TbConfigDd::getDicType, CommonConstant.subPlatformAngleDictType));
//		List<TbRtAmcStatusDd> amcStatusDds = iTbRtAmcStatusDdService
//			.list(new LambdaQueryWrapper<TbRtAmcStatusDd>().eq(TbRtAmcStatusDd::getTrialId, trialId)
//				.isNotNull(TbRtAmcStatusDd::getTime).orderByAsc(TbRtAmcStatusDd::getTime));
//		DataVo dataVo = new DataVo();
//		List<ChildTypesAngleVo> list = new ArrayList<>();
//		if (null != amcStatusDds && amcStatusDds.size() > 0) {
//			configDds.forEach(configDd -> {
//				ChildTypesAngleVo childTypesAngleVo = new ChildTypesAngleVo();
//				childTypesAngleVo.setUnit(configDd.getUnit());
//				childTypesAngleVo.setChildName(configDd.getDicName());
//				List<ChildListVo> childListVos = new ArrayList<>();
//				amcStatusDds.forEach(amcStatusDd -> {
//					Map<String, Object> amcStatusDdMap = BeanUtil.beanToMap(amcStatusDd);
//					ChildListVo childListVo = new ChildListVo();
//					childListVo.setNumerValue(null == amcStatusDdMap.get(configDd.getDicCode()) ? "0" : amcStatusDdMap.get(configDd.getDicCode()).toString());
//					childListVo.setTimeValue(simpleDateFormat.format(amcStatusDd.getTime()));
//					childListVos.add(childListVo);
//				});
//				childTypesAngleVo.setDataList(childListVos);
//				list.add(childTypesAngleVo);
//			});
//			if (list.size() > 0) {
//				dataVo.setChildTypes(list);
//				dataVo.setParentName(CommonConstant.bearingPlatform);
//			}
//		}
//		dataVos.add(dataVo);
//		responseVo.setData(dataVos);
//		return responseVo;
//	}
//
//	/**
//	 * 回放---浮吊船运动、综合保障船
//	 *
//	 * @return
//	 */
//	@ApiOperation("回放-浮吊船运动、综合保障船")
//	@PostMapping("selectShipMoveData")
//	public ResponseVo selectShipMoveData(@RequestParam(value = "data.trialId") String trialId,
//										 @RequestParam(value = "data.shipType") String shipType) {
//		List<ShipMoveDataVo> shipMoveDataVos = new ArrayList<>();
//		// shipType = "Tug".equals(shipType) ? "11" : "09";
//		//获取船只类型
//		TbModelMotionDd modelMotionDd = iTbModelMotionDdService
//			.getOne(Wrappers.<TbModelMotionDd>lambdaQuery().eq(TbModelMotionDd::getType, shipType));
//		if (null == modelMotionDd) {
//			return new ResponseVo(shipMoveDataVos);
//		}
//		//获取模型运动数据
//		LambdaQueryWrapper<TbRtGnrmcGpsDd> gnrmcGpsWrapper = new LambdaQueryWrapper<>();
//		gnrmcGpsWrapper
//			.eq(TbRtGnrmcGpsDd::getTrialId, trialId).eq(TbRtGnrmcGpsDd::getTargetNumber, modelMotionDd.getTargetNum())
//			.isNotNull(TbRtGnrmcGpsDd::getTime).orderByAsc(TbRtGnrmcGpsDd::getTime);
//		List<TbRtGnrmcGpsDd> tbRtGnrmcGpsDds = iTbRtGnrmcGpsDdService.list(gnrmcGpsWrapper);
//		if (null != tbRtGnrmcGpsDds && tbRtGnrmcGpsDds.size() > 0) {
//			tbRtGnrmcGpsDds.forEach(tbRtGnrmcGpsDd -> {
//				ShipMoveDataVo shipMoveDataVo = new ShipMoveDataVo();
//				shipMoveDataVo
//					.setId(modelMotionDd.getMotionId()).setType(modelMotionDd.getType())
//					.setMoveType(modelMotionDd.getMoveType()).setTime(simpleDateFormat.format(tbRtGnrmcGpsDd.getTime()))
//					.setLat(tbRtGnrmcGpsDd.getLatitude()).setLng(tbRtGnrmcGpsDd.getLongitude())
//					.setYaw(tbRtGnrmcGpsDd.getCourse()).setHeight("0").setRoll("0")
//					.setPitch("0").setMovSpeed("0.5").setRotSpeed("0.5");
//				shipMoveDataVos.add(shipMoveDataVo);
//			});
//		}
//		return new ResponseVo(shipMoveDataVos);
//	}

	@ApiOperation("阶段信息")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectSystemMessage")
	public ResponseVo selectSystemMessage(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		List<Object> result = new ArrayList<>();
		List<TbSystemMessage> messages = iTbSystemMessageService
			.list(Wrappers.<TbSystemMessage>lambdaQuery().eq(TbSystemMessage::getTrialId, trialId));
		messages.forEach(message -> {
			Map<String, Object> map = new HashMap<>();
			map.put("message", message.getMessageContent());
			map.put("dataTime", message.getMessageTime());
			result.add(map);
		});

		return new ResponseVo(result);
	}


	@ApiOperation("回放-子平台运动")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectSubplatformMoveData")
	public ResponseVo selectSubplatformMoveData(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		List<SubplatformMoveDataVo> subplatformMoveDataVos = new ArrayList<>();
		List<TbRtAmcStatusDd> amcStatusDds = iTbRtAmcStatusDdService.list(new LambdaQueryWrapper<TbRtAmcStatusDd>()
			.eq(TbRtAmcStatusDd::getTrialId, trialId)
			.isNotNull(TbRtAmcStatusDd::getSendTime).orderByAsc(TbRtAmcStatusDd::getSendTime));
		if (null != amcStatusDds && amcStatusDds.size() > 0) {
			amcStatusDds.forEach(amcStatusDd -> {
				SubplatformMoveDataVo subplatformMoveDataVo = new SubplatformMoveDataVo();
				subplatformMoveDataVo
					.setTime(simpleDateFormat.format(amcStatusDd.getSendTime()))
					.setMovSpeed("0.5").setSubPlatformDistance(amcStatusDd.getSubPlatformDistance());
				subplatformMoveDataVos.add(subplatformMoveDataVo);
			});
		}
		return new ResponseVo(subplatformMoveDataVos);
	}

	@ApiOperation("回放-平台下潜")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectPlatformMoveData")
	public ResponseVo selectPlatformMoveData(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		List<PlatformMoveDataVo> platformMoveDataVos = new ArrayList<>();
		List<TbRtAmcStatusDd> amcStatusDds = iTbRtAmcStatusDdService
			.list(new LambdaQueryWrapper<TbRtAmcStatusDd>().eq(TbRtAmcStatusDd::getTrialId, trialId)
				.isNotNull(TbRtAmcStatusDd::getTime).orderByAsc(TbRtAmcStatusDd::getTime));
		if (null != amcStatusDds && amcStatusDds.size() > 0) {
			amcStatusDds.forEach(amcStatusDd -> {
				PlatformMoveDataVo platformMoveDataVo = new PlatformMoveDataVo();
				platformMoveDataVo
					.setTime(simpleDateFormat.format(amcStatusDd.getTime())).setHeight(amcStatusDd.getPlatformCenterDepth())
					.setYaw(amcStatusDd.getPlatformTileAngleX()).setPitch(amcStatusDd.getPlatformTileAngleY())
					.setRoll("0").setMovSpeed("0.5").setRotSpeed("0.5");

				platformMoveDataVos.add(platformMoveDataVo);
			});
		}
		return new ResponseVo(platformMoveDataVos);
	}

	@ApiOperation("回放-模型弹运动")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectProductMoveData")
	public ResponseVo selectProductMoveData(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		ArrayList<ProductMoveDataVo> productMoveDataVos = new ArrayList<>();
		LambdaQueryWrapper<TbModelMotionDd> modelMotionWrapper = new LambdaQueryWrapper<>();
		modelMotionWrapper.eq(TbModelMotionDd::getMotionId, CommonConstant.motionId);
		TbModelMotionDd modelMotionDd = iTbModelMotionDdService.getOne(modelMotionWrapper);

		List<TbProductOperationDd> productOperationDds = iTbProductOperationDdService
			.list(new LambdaQueryWrapper<TbProductOperationDd>().eq(TbProductOperationDd::getTrialId, trialId)
				.isNotNull(TbProductOperationDd::getTime).orderByAsc(TbProductOperationDd::getTime));
		if (null != productOperationDds && productOperationDds.size() > 0) {
			productOperationDds.forEach(productOperationDd -> {
				ProductMoveDataVo productMoveDataVo = new ProductMoveDataVo();
				productMoveDataVo
					.setId(modelMotionDd.getMotionId()).setMoveType(modelMotionDd.getMoveType())
					.setType(modelMotionDd.getType()).setTime(simpleDateFormat.format(productOperationDd.getTime()))
					.setLat(productOperationDd.getLat()).setLng(productOperationDd.getLon())
					.setHeight(productOperationDd.getHight()).setPitch(productOperationDd.getFy())
					.setRoll(productOperationDd.getHg()).setYaw(productOperationDd.getPh())
					.setMovSpeed("5").setRotSpeed("5");

				productMoveDataVos.add(productMoveDataVo);
			});
		}
		return new ResponseVo(productMoveDataVos);
	}


	@ApiOperation("回放-子平台工作模式")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectSubPlatformWorkMode")
	public List<Map<String, Object>> selectSubPlatformWorkMode(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		List<TbRtAmcStatusDd> amcStatusDds = iTbRtAmcStatusDdService
			.list(new LambdaQueryWrapper<TbRtAmcStatusDd>().eq(TbRtAmcStatusDd::getTrialId, trialId)
				.isNotNull(TbRtAmcStatusDd::getSendTime).orderByAsc(TbRtAmcStatusDd::getSendTime));
		List<Map<String, Object>> list = new ArrayList<>();
		if (null != amcStatusDds && amcStatusDds.size() > 0) {
			amcStatusDds.forEach(amcStatusDd -> {
				Map<String, Object> subPlatWorkResult = new HashMap<>();
				List<SubPlatWork> subPlatWorks = new ArrayList<>();
				for (String subPlatFormWokeModeFiled : CommonConstant.subPlatFormWokeModeFiles) {
					SubPlatWork subPlatWork = new SubPlatWork();
					subPlatWork
						.setId(subPlatFormWokeModeFiled)
						.setKey(amcStatusDd.getSubPlatformWorkMode());
					if (CommonConstant.subPlatformWorkMode.equals(subPlatFormWokeModeFiled)) {
						subPlatWork.setValue(amcStatusDd.getSubPlatformWorkMode().equals("0") ? "调试模式" : "发射模式");
					} else if (CommonConstant.subPlatformControlMode.equals(subPlatFormWokeModeFiled)) {
						subPlatWork.setValue(amcStatusDd.getSubPlatformControlMode().equals("0") ? "手动模式" : "自动模式");
					}
					subPlatWorks.add(subPlatWork);
				}
				subPlatWorkResult.put("time", simpleDateFormat.format(amcStatusDd.getTime()));
				subPlatWorkResult.put("data", subPlatWorks);
				list.add(subPlatWorkResult);
			});
		}
		return list;
	}

	@ApiOperation("回放-承载平台工作模式")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectPlatformWorkMode")
	public List<Map<String, Object>> selectPlatformWorkMode(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		List<TbRtAmcStatusDd> amcStatusDds = iTbRtAmcStatusDdService
			.list(new LambdaQueryWrapper<TbRtAmcStatusDd>().eq(TbRtAmcStatusDd::getTrialId, trialId)
				.isNotNull(TbRtAmcStatusDd::getTime).orderByAsc(TbRtAmcStatusDd::getTime));
		List<Map<String, Object>> list = new ArrayList<>();
		if (null != amcStatusDds && amcStatusDds.size() > 0) {
			amcStatusDds.forEach(amcStatusDd -> {
				Map<String, Object> amcStatusMap = BeanUtil.beanToMap(amcStatusDd);
				Map<String, Object> subPlatWorkResult = new HashMap<>();
				List<SubPlatWork> subPlatWorks = new ArrayList<>();
				for (String platFormStatusFiled : CommonConstant.PLAT_FORM_STATUS_FILEDS) {
					String keyStr = Integer.parseInt(amcStatusMap.get(platFormStatusFiled).toString()) + "";
					SubPlatWork subPlatWork = new SubPlatWork();
					subPlatWork.setId(platFormStatusFiled);
					subPlatWork.setKey(keyStr);
					if (CommonConstant.workMode.equals(platFormStatusFiled)) {
						subPlatWork.setValue(keyStr.equals("1") ? "手动" : keyStr.equals("2") ? "自动" : "停止");
					} else if (CommonConstant.vehicleFlag.equals(platFormStatusFiled)) {
						subPlatWork.setValue(keyStr.equals("0") ? "不到位" : "到位");
					} else {
						subPlatWork.setValue(keyStr.equals("0") ? "未开始" : keyStr.equals("1") ? "执行中" : "已完成");
					}
					subPlatWorks.add(subPlatWork);
				}
				subPlatWorkResult.put("time", simpleDateFormat.format(amcStatusDd.getTime()));
				subPlatWorkResult.put("data", subPlatWorks);
				list.add(subPlatWorkResult);
			});
		}
		return list;
	}


	@ApiOperation("回放-模型弹状态")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectProductOperationStatus")
	public ResponseVo selectProductOperationStatus(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		ResponseVo responseVo = new ResponseVo();
		//从配置类获取模型弹配置信息
		List<TbConfigDd> configDds = iTbConfigDdService
			.list(new LambdaQueryWrapper<TbConfigDd>().eq(TbConfigDd::getDicType, CommonConstant.productOperation));
		//获取模型弹数据
		List<TbProductOperationDd> productOperationDds = iTbProductOperationDdService
			.list(new LambdaQueryWrapper<TbProductOperationDd>().eq(TbProductOperationDd::getTrialId, trialId)
				.isNotNull(TbProductOperationDd::getTime).orderByAsc(TbProductOperationDd::getTime));
		List<Map<String, Object>> list = new ArrayList<>();
		Map<String, Object> attitudeAngleMap = new HashMap<>();
		List<ProductOperationVo> attitudeAngles = new ArrayList<>();
		if (null != configDds && configDds.size() > 0) {
			configDds.forEach(config -> {
				if (null != productOperationDds && productOperationDds.size() > 0) {
					Map<String, Object> resultMap = new HashMap<>();
					List<ProductOperationDataList> dataList = new ArrayList<>();
					List<ProductOperationVo> productOperationVos = new ArrayList<>();
					productOperationDds.forEach(productOperationDd -> {
						ProductOperationDataList operationDataList = new ProductOperationDataList();
						Map<String, Object> map = BeanUtil.beanToMap(productOperationDd);
						operationDataList.setNumerValue(map.get(config.getDicCode()));
						operationDataList.setTimeValue(simpleDateFormat.format(productOperationDd.getTime()));
						dataList.add(operationDataList);
					});
					if (Arrays.asList(CommonConstant.attitudeAngleArray).contains(config.getDicCode())) {
						attitudeAngles.add(new ProductOperationVo(config.getUnit(), config.getDicName(), dataList));
					} else {
						productOperationVos.add(new ProductOperationVo(config.getUnit(), config.getDicName(), dataList));
						resultMap.put("childTypes", productOperationVos);
						resultMap.put("parentName", config.getDicName());
						list.add(resultMap);
					}
				}
			});
			if (attitudeAngles.size() > 0) {
				attitudeAngleMap.put("childTypes", attitudeAngles);
				attitudeAngleMap.put("parentName", "姿态角");
				list.add(attitudeAngleMap);
			}
		}
		responseVo.setData(list);
		return responseVo;
	}


	@ApiOperation("回放---选择实验接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.taskNumber"
	})
	@PostMapping("/selectTrialInfo")
	public ResponseVo selectTrialInfo(@RequestBody @Valid ComQuery query) {
		String taskNumber = query.getData().getTaskNumber();
		List<TbTrialInformationDd> trialInformationDds = iTbTrialInformationDdService.list()
			.stream().filter(p -> null != p.getTrialType() && p.getTrialType().trim().equals(CommonConstant.trialRealType)).collect(Collectors.toList());
		if (StrUtil.isNotEmpty(taskNumber)) {
			trialInformationDds = trialInformationDds
				.stream().filter(p -> p.getTaskNumber().contains(taskNumber)).collect(Collectors.toList());
		}
		List<TbTrialInformationDdVo> trialInformationDdVos = new ArrayList<>();
		if (trialInformationDds.size() > 0) {
			trialInformationDds.forEach(trialInformationDd -> {
				TbTrialInformationDdVo trialInformationDdVo = new TbTrialInformationDdVo();
				trialInformationDdVo.setTrialId(trialInformationDd.getTrialId());
				trialInformationDdVo.setProductNum(trialInformationDd.getProductNum());
				trialInformationDdVo.setProjectName(trialInformationDd.getProjectName());
				trialInformationDdVo.setTaskNumber(trialInformationDd.getTaskNumber());
				trialInformationDdVo.setTrialType(trialInformationDd.getTrialType());
				trialInformationDdVo.setProjectDate(trialInformationDd.getProjectDate());
				trialInformationDdVos.add(trialInformationDdVo);
			});
		}
		return new ResponseVo(trialInformationDdVos);
	}

	@ApiOperation("回放---发送试验准备指令")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendTestPreparation")
	public InstructCommandVo sendTestPreparation(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		InstructCommandVo instructCommandVo = new InstructCommandVo();

		QueryWrapper<TbSystemTtagerecordDd> QueryWrapper = new QueryWrapper<>();
		QueryWrapper.lambda()
			.eq(StrUtil.isNotBlank(trialId), TbSystemTtagerecordDd::getTrialId, trialId)
			.eq(TbSystemTtagerecordDd::getStageId, CommonConstant.testPreparation).last("limit 1");

		List<TbSystemTtagerecordDd> systemTtagerecordDds = iTbSystemTtagerecordDdService.list(QueryWrapper);
		if (null != systemTtagerecordDds && systemTtagerecordDds.size() > 0) {
			TbSystemTtagerecordDd systemTtagerecordDd = systemTtagerecordDds.get(0);
			if (null != systemTtagerecordDd) {
				instructCommandVo.setStageID(systemTtagerecordDd.getStageId());
				if (null != systemTtagerecordDd.getStageKey()) {
					instructCommandVo.setStageKey(systemTtagerecordDd.getStageKey().toString());
				}
				if (null != systemTtagerecordDd.getTime()) {
					instructCommandVo.setCreateTime(simpleDateFormat.format(systemTtagerecordDd.getTime()));
				}
				instructCommandVo.setCommandValue(systemTtagerecordDd.getCommand());
			}
		}
		return instructCommandVo;
	}

	@ApiOperation("回放---发送产品转运指令")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendProducttransfer")
	public InstructCommandVo sendProducttransfer(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		InstructCommandVo instructCommandVo = new InstructCommandVo();

		QueryWrapper<TbSystemTtagerecordDd> QueryWrapper = new QueryWrapper<>();
		QueryWrapper.lambda().eq(TbSystemTtagerecordDd::getTrialId, trialId)
			.eq(TbSystemTtagerecordDd::getStageId, CommonConstant.producttransfer);

		List<TbSystemTtagerecordDd> systemTtagerecordDds = iTbSystemTtagerecordDdService.list(QueryWrapper);
		if (null != systemTtagerecordDds && systemTtagerecordDds.size() > 0) {
			TbSystemTtagerecordDd systemTtagerecordDd = systemTtagerecordDds.get(0);
			if (null != systemTtagerecordDd) {
				instructCommandVo.setStageID(systemTtagerecordDd.getStageId());
				if (null != systemTtagerecordDd.getStageKey()) {
					instructCommandVo.setStageKey(systemTtagerecordDd.getStageKey().toString());
				}
				if (null != systemTtagerecordDd.getTime()) {
					instructCommandVo.setCreateTime(simpleDateFormat.format(systemTtagerecordDd.getTime()));
				}
				instructCommandVo.setCommandValue(systemTtagerecordDd.getCommand());
			}
		}
		return instructCommandVo;
	}

	@ApiOperation("回放---发送产品转运动画指令")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendProducttransferAnimation")
	public InstructCommandVo sendProducttransferAnimation(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		InstructCommandVo instructCommandVo = new InstructCommandVo();

		QueryWrapper<TbSystemTtagerecordDd> QueryWrapper = new QueryWrapper<>();
		QueryWrapper.lambda().eq(TbSystemTtagerecordDd::getTrialId, trialId)
			.eq(TbSystemTtagerecordDd::getStageId, CommonConstant.producttransfer)
			.eq(TbSystemTtagerecordDd::getCommand, CommonConstant.producttransferAnimation);

		List<TbSystemTtagerecordDd> systemTtagerecordDds = iTbSystemTtagerecordDdService.list(QueryWrapper);
		if (null != systemTtagerecordDds && systemTtagerecordDds.size() > 0) {
			TbSystemTtagerecordDd systemTtagerecordDd = systemTtagerecordDds.get(0);
			if (null != systemTtagerecordDd) {
				instructCommandVo.setStageID(systemTtagerecordDd.getStageId());
				if (null != systemTtagerecordDd.getStageKey()) {
					instructCommandVo.setStageKey(systemTtagerecordDd.getStageKey().toString());
				}
				if (null != systemTtagerecordDd.getTime()) {
					instructCommandVo.setCreateTime(simpleDateFormat.format(systemTtagerecordDd.getTime()));
				}
				instructCommandVo.setCommandValue(systemTtagerecordDd.getCommand());
			}
		}
		return instructCommandVo;
	}

	@ApiOperation("回放---发送产品装填指令（产品装填）")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendProductFilling")
	public InstructCommandVo sendProductFilling(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		InstructCommandVo instructCommandVo = new InstructCommandVo();

		QueryWrapper<TbSystemTtagerecordDd> QueryWrapper = new QueryWrapper<>();
		QueryWrapper.lambda().eq(TbSystemTtagerecordDd::getTrialId, trialId)
			.eq(TbSystemTtagerecordDd::getStageId, CommonConstant.productFilling);

		List<TbSystemTtagerecordDd> systemTtagerecordDds = iTbSystemTtagerecordDdService.list(QueryWrapper);
		if (null != systemTtagerecordDds && systemTtagerecordDds.size() > 0) {
			TbSystemTtagerecordDd systemTtagerecordDd = systemTtagerecordDds.get(0);
			if (null != systemTtagerecordDd) {
				instructCommandVo.setStageID(systemTtagerecordDd.getStageId());
				if (null != systemTtagerecordDd.getStageKey()) {
					instructCommandVo.setStageKey(systemTtagerecordDd.getStageKey().toString());
				}
				if (null != systemTtagerecordDd.getTime()) {
					instructCommandVo.setCreateTime(simpleDateFormat.format(systemTtagerecordDd.getTime()));
				}
				instructCommandVo.setCommandValue(systemTtagerecordDd.getCommand());
			}
		}
		return instructCommandVo;
	}

	@ApiOperation("回放---发送产品装填动画指令（产品装填）")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendProductFillingAnimation")
	public InstructCommandVo sendProductFillingAnimation(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		InstructCommandVo instructCommandVo = new InstructCommandVo();

		QueryWrapper<TbSystemTtagerecordDd> QueryWrapper = new QueryWrapper<>();
		QueryWrapper.lambda().eq(TbSystemTtagerecordDd::getTrialId, trialId)
			.eq(TbSystemTtagerecordDd::getStageId, CommonConstant.productFilling)
			.eq(TbSystemTtagerecordDd::getCommand, CommonConstant.producttransferAnimation);

		List<TbSystemTtagerecordDd> systemTtagerecordDds = iTbSystemTtagerecordDdService.list(QueryWrapper);
		if (null != systemTtagerecordDds && systemTtagerecordDds.size() > 0) {
			TbSystemTtagerecordDd systemTtagerecordDd = systemTtagerecordDds.get(0);
			if (null != systemTtagerecordDd) {
				instructCommandVo.setStageID(systemTtagerecordDd.getStageId());
				if (null != systemTtagerecordDd.getStageKey()) {
					instructCommandVo.setStageKey(systemTtagerecordDd.getStageKey().toString());
				}
				if (null != systemTtagerecordDd.getTime()) {
					instructCommandVo.setCreateTime(simpleDateFormat.format(systemTtagerecordDd.getTime()));
				}
				instructCommandVo.setCommandValue(systemTtagerecordDd.getCommand());
			}
		}
		return instructCommandVo;
	}


	@ApiOperation("项目信息接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectProjectInformation")
	public ProjectInformationVo selectProjectInformation(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		String ipAddr = query.getData().getIpAddr();
		//tb_trialInformation   tb_productInformation   tb_underwaterPlatformInfo使用实验id来关联
		ProjectInformationVo projectInformationVo = new ProjectInformationVo();

		//获取试验任务基本信息n
		TbTrialInformationDd trialInformationDd = getTrialInformationDd(trialId, ipAddr);
		if (null != trialInformationDd) {
			projectInformationVo.setTrialId(trialInformationDd.getTrialId());   //tb_trialInformation  trialId
			projectInformationVo.setProjectName(trialInformationDd.getProjectName());  //tb_trialInformation  projectName
			projectInformationVo.setTaskNumber(trialInformationDd.getTaskNumber());  //tb_trialInformation  taskNumber
			projectInformationVo.setProductNum(trialInformationDd.getProductNum());  //tb_trialInformation  productNum
			projectInformationVo.setProjectdate(DateUtil.formatDate(trialInformationDd.getProjectDate()));  //tb_trialInformation  projectDate

			//平台信息
			QueryWrapper<TbUnderwaterPlatformInfoDd> underwaterPlatformInfoDdQueryWrapper = new QueryWrapper<>();
			underwaterPlatformInfoDdQueryWrapper.lambda().eq(TbUnderwaterPlatformInfoDd::getTrialId, trialInformationDd.getTrialId());

			TbUnderwaterPlatformInfoDd underwaterPlatformInfoDd = iTbUnderwaterPlatformInfoDdService.getOne(underwaterPlatformInfoDdQueryWrapper);
			List<TbConfigDd> configDds = iTbConfigDdService.list(Wrappers.<TbConfigDd>lambdaQuery()
				.eq(TbConfigDd::getDicType, CommonConstant.platformInfo)
				.orderByAsc(TbConfigDd::getUnit));
			Map<String, Object> platformMap = BeanUtil.beanToMap(underwaterPlatformInfoDd);
			if (null != underwaterPlatformInfoDd) {
				Map<String, Object> platformInfoMap = new LinkedHashMap<>();
				Map<String, Object> subPlatformInfoMap = new LinkedHashMap<>();
				configDds.forEach(config -> {
					//平台
					if (Objects.equals(config.getRemark(), CommonConstant.platformInfo)) {
						platformInfoMap.put(config.getDicName(), platformMap.get(config.getDicCode()));
					}
					//子平台
					else if (Objects.equals(config.getRemark(), CommonConstant.subPlatformInfo)) {
						subPlatformInfoMap.put(config.getDicName(), platformMap.get(config.getDicCode()));
					}
				});
				projectInformationVo.setPlatformInfo(platformInfoMap);
				projectInformationVo.setSubPlatformInfo(subPlatformInfoMap);
			}


		}
		return projectInformationVo;
	}

	@ApiOperation("仿真 项目信息接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectProjectInformationSimulation")
	public ProjectInformationVo selectProjectInformationTwo(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		//tb_trialInformation   tb_productInformation   tb_underwaterPlatformInfo使用实验id来关联
		ProjectInformationVo projectInformationVo = new ProjectInformationVo();

		//获取试验任务基本信息n
		/*if (StringUtils.isEmpty(trialId)) {
			TbTrialInformationDd trialInfoSimulation = getTrialInfoSimulation();
			trialId = trialInfoSimulation.getTrialId();
		}
		TbTrialInformationDd trialInformationDd = getTrialInfoSimulation(trialId);*/
		//TbTrialInformationDd trialInformationDd = StringUtils.isEmpty(trialId) ? getTrialInfoSimulation() : getTrialInfoSimulation(trialId);
		TbTrialInformationDd trialInformationDd = getTrialInfoSimulation(trialId);

		if (null != trialInformationDd) {
			projectInformationVo.setTrialId(trialInformationDd.getTrialId());   //tb_trialInformation  trialId
			projectInformationVo.setProjectName(trialInformationDd.getProjectName());  //tb_trialInformation  projectName
			projectInformationVo.setTaskNumber(trialInformationDd.getTaskNumber());  //tb_trialInformation  taskNumber
			projectInformationVo.setProductNum(trialInformationDd.getProductNum());  //tb_trialInformation  productNum
			projectInformationVo.setProjectdate(DateUtil.formatDate(trialInformationDd.getProjectDate()));  //tb_trialInformation  projectDate

			//平台信息
			QueryWrapper<TbUnderwaterPlatformInfoDd> underwaterPlatformInfoDdQueryWrapper = new QueryWrapper<>();
			underwaterPlatformInfoDdQueryWrapper.lambda().eq(TbUnderwaterPlatformInfoDd::getTrialId, trialInformationDd.getTrialId());

			TbUnderwaterPlatformInfoDd underwaterPlatformInfoDd = iTbUnderwaterPlatformInfoDdService.getOne(underwaterPlatformInfoDdQueryWrapper);
			List<TbConfigDd> configDds = iTbConfigDdService.list(Wrappers.<TbConfigDd>lambdaQuery()
				.eq(TbConfigDd::getDicType, CommonConstant.platformInfo)
				.orderByAsc(TbConfigDd::getUnit));
			Map<String, Object> platformMap = BeanUtil.beanToMap(underwaterPlatformInfoDd);
			if (null != underwaterPlatformInfoDd) {
				Map<String, Object> platformInfoMap = new LinkedHashMap<>();
				Map<String, Object> subPlatformInfoMap = new LinkedHashMap<>();
				configDds.forEach(config -> {
					//平台
					if (Objects.equals(config.getRemark(), CommonConstant.platformInfo)) {
						platformInfoMap.put(config.getDicName(), platformMap.get(config.getDicCode()));
					}
					//子平台
					else if (Objects.equals(config.getRemark(), CommonConstant.subPlatformInfo)) {
						subPlatformInfoMap.put(config.getDicName(), platformMap.get(config.getDicCode()));
					}
				});
				projectInformationVo.setPlatformInfo(platformInfoMap);
				projectInformationVo.setSubPlatformInfo(subPlatformInfoMap);
			}


		}
		return projectInformationVo;
	}

	@ApiOperation("回放-任务流程接口,根据阶段id查出不同阶段的流程图")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.stageId"
	})
	@PostMapping("/selectTaskFlow")
	public TaskFlowVo selectTaskFlow(@RequestBody @Valid ComQuery query) {
		String stageId = query.getData().getStageId();
		TaskFlowVo taskFlowVo = new TaskFlowVo();
		QueryWrapper<TbSystemTtageDd> QueryWrapper = new QueryWrapper<>();
		QueryWrapper.lambda().eq(TbSystemTtageDd::getStageId, stageId);
		//获取试验任务基本信息
		TbSystemTtageDd tbSystemTtageDd = iTbSystemTtageDdService.getOne(QueryWrapper);
		if (null != tbSystemTtageDd) {
			//tb_systemTtage
			taskFlowVo.setStageId(tbSystemTtageDd.getStageId());  //stageId
			taskFlowVo.setFlowchartName(tbSystemTtageDd.getFlowchartName());  //flowchartName
			taskFlowVo.setFlowchartType(tbSystemTtageDd.getFlowchartType());   //flowchartType
			taskFlowVo.setStageName(tbSystemTtageDd.getStageName());   //stageName
			taskFlowVo.setFlowchartUrl(tbSystemTtageDd.getFlowchartUrl());  //flowchartUrl
		}
		return taskFlowVo;
	}


	@ApiOperation("回放-流程阶段")
	@PostMapping("/selectProcessStage")
	public ResponseVo selectProcessStage() {
		//tb_systemTtage
		List<TaskFlowVo> taskFlowVos = new ArrayList<>();
		//查询状态为1
		List<TbSystemTtageDd> systemTtageDds = iTbSystemTtageDdService
			.list(Wrappers.<TbSystemTtageDd>lambdaQuery().eq(TbSystemTtageDd::getDisplayStatus, "1"));
		if (null != systemTtageDds && systemTtageDds.size() > 0) {
			systemTtageDds.stream().forEach(systemTtageDd -> {
				List<TbSystemTtageCommandDd> commandDds = iTbSystemTtageCommandDdService
					.list(new LambdaQueryWrapper<TbSystemTtageCommandDd>().eq(TbSystemTtageCommandDd::getStageId, systemTtageDd.getStageId())
						.eq(TbSystemTtageCommandDd::getState, CommonConstant.statusOne)
						.ne(TbSystemTtageCommandDd::getCommandName, CommonConstant.phaseSwitching));
				List<Object> subStages = new ArrayList<>();
				TaskFlowVo taskFlowVo = new TaskFlowVo();
				taskFlowVo.setStageId(systemTtageDd.getStageId());  //stageId
				taskFlowVo.setStageName(systemTtageDd.getStageName());  //stageName
				taskFlowVo.setFlowchartUrl(systemTtageDd.getFlowchartUrl());
				taskFlowVo.setFlowchartType(systemTtageDd.getFlowchartType());
				taskFlowVo.setFlowchartName(systemTtageDd.getFlowchartName());
				if (null != commandDds && commandDds.size() > 0)
					commandDds.forEach(commandDd -> {
						HashMap<String, Object> map = new HashMap<>();
						map.put("subStageName", commandDd.getCommandName());
						subStages.add(map);
					});
				taskFlowVo.setSubStages(subStages);
				taskFlowVos.add(taskFlowVo);
			});
		}
		return new ResponseVo(taskFlowVos);
	}

	/**
	 * 如果传试验id(trialId)就获取该试验的数据。如果trialId为空，则获取最新的试验id
	 *
	 * @return
	 */
	public TbTrialInformationDd getTrialInformationDd(String trialId, HttpServletRequest request) {
		LambdaQueryWrapper<TbTrialInformationDd> queryWrapper = new LambdaQueryWrapper<>();
		if (StringUtils.isEmpty(trialId)) {
			if (request != null) {
				String ipAddr = IpUtils.getIpAddr(request);
				if (StringUtils.isNotBlank(ipAddr)) {
					queryWrapper.eq(TbTrialInformationDd::getIpAddress, ipAddr);
					queryWrapper.eq(TbTrialInformationDd::getIpState, "1");
					TbTrialInformationDd info = iTbTrialInformationDdService.getOne(queryWrapper);
					if (info == null) {
						queryWrapper = new LambdaQueryWrapper<>();
						queryWrapper.eq(TbTrialInformationDd::getState, CommonConstant.trialInfoState);
					} else {
						return info;
					}
				} else {
					queryWrapper.eq(TbTrialInformationDd::getState, CommonConstant.trialInfoState);
				}
			} else {
				queryWrapper.eq(TbTrialInformationDd::getState, CommonConstant.trialInfoState);
			}
		} else {
			queryWrapper.eq(TbTrialInformationDd::getTrialId, trialId);
		}
		return iTbTrialInformationDdService.getOne(queryWrapper);
	}

	public TbTrialInformationDd getTrialInformationDd(String trialId, String ipAddr) {
		LambdaQueryWrapper<TbTrialInformationDd> queryWrapper = new LambdaQueryWrapper<>();
		if (StringUtils.isEmpty(trialId)) {
			if (ipAddr != null) {
				if (StringUtils.isNotBlank(ipAddr)) {
					queryWrapper.eq(TbTrialInformationDd::getIpAddress, ipAddr);
					queryWrapper.eq(TbTrialInformationDd::getIpState, "1");
					TbTrialInformationDd info = iTbTrialInformationDdService.getOne(queryWrapper);
					if (info == null) {
						queryWrapper = new LambdaQueryWrapper<>();
						queryWrapper.eq(TbTrialInformationDd::getState, CommonConstant.trialInfoState);
					} else {
						return info;
					}
				} else {
					queryWrapper.eq(TbTrialInformationDd::getState, CommonConstant.trialInfoState);
				}
			} else {
				queryWrapper.eq(TbTrialInformationDd::getState, CommonConstant.trialInfoState);
			}
		} else {
			queryWrapper.eq(TbTrialInformationDd::getTrialId, trialId);
		}
		return iTbTrialInformationDdService.getOne(queryWrapper);
	}

	/**
	 * 仿真
	 *
	 * @return
	 */
	/*public TbTrialInformationDd getTrialInfoSimulation() {
		TbTrialInformationDd trialInformationDd = iTbTrialInformationDdService
			.getOne(Wrappers.<TbTrialInformationDd>lambdaQuery().eq(TbTrialInformationDd::getTrialType, "仿真")
				.eq(TbTrialInformationDd::getRemark, "1")
				.orderByDesc(TbTrialInformationDd::getProjectDate)
				.last("limit 1"));
		return trialInformationDd;
	}*/

	/**
	 * 仿真
	 *
	 * @return
	 */
	public TbTrialInformationDd getTrialInfoSimulation(String trialId) {
		LambdaQueryWrapper<TbTrialInformationDd> wrapper = Wrappers.lambdaQuery();
		wrapper.eq(TbTrialInformationDd::getTrialType, "仿真").eq(TbTrialInformationDd::getRemark, "1")
			.orderByDesc(TbTrialInformationDd::getProjectDate).last("limit 1");
		if (StrUtil.isNotEmpty(trialId)) {
			wrapper.eq(TbTrialInformationDd::getTrialId, trialId);
		}
		return iTbTrialInformationDdService
			.getOne(wrapper);
	}


	/**
	 * 获取最新的实航试验信息
	 *
	 * @return
	 */
	public String getTrialId() {
		LambdaQueryWrapper<TbTrialInformationDd> lambdaQueryWrapper = new LambdaQueryWrapper<>();
		lambdaQueryWrapper.eq(TbTrialInformationDd::getState, CommonConstant.trialInfoState)
			.last("limit 1");
		TbTrialInformationDd trialInformationDd = iTbTrialInformationDdService.getOne(lambdaQueryWrapper);
		return trialInformationDd.getTrialId();
	}

	/**
	 * 获取最新的仿真试验信息
	 *
	 * @return
	 */
	public String getTrialIdSimulation() {
		LambdaQueryWrapper<TbTrialInformationDd> lambdaQueryWrapper = new LambdaQueryWrapper<>();
		lambdaQueryWrapper.eq(TbTrialInformationDd::getRemark, CommonConstant.trialInfoSimulationState)
			.last("limit 1");
		TbTrialInformationDd trialInformationDd = iTbTrialInformationDdService.getOne(lambdaQueryWrapper);
		return trialInformationDd.getTrialId();
	}

	@ApiOperation("产品基本信息接口(仿真)")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectProductInfoSimulation")
	public ResponseVo selectProductInfoTwo(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		List<ProductCommonVo> productCommonVos = new ArrayList<>();

		/*if (ObjectUtil.isEmpty(trialId)) {
			trialId = getTrialIdSimulation();
		}*/
		TbTrialInformationDd trialInformationDd = getTrialInfoSimulation(trialId);
		if (ObjectUtil.isEmpty(trialInformationDd)) {
			return new ResponseVo(productCommonVos);
		}
		trialId = trialInformationDd.getTrialId();

		//平台信息
		QueryWrapper<TbUnderwaterPlatformInfoDd> underwaterPlatformInfoDdQueryWrapper = new QueryWrapper<>();
		underwaterPlatformInfoDdQueryWrapper.lambda().eq(TbUnderwaterPlatformInfoDd::getTrialId, trialId);
		TbUnderwaterPlatformInfoDd underwaterPlatformInfoDd = iTbUnderwaterPlatformInfoDdService.getOne(underwaterPlatformInfoDdQueryWrapper);

		if (null != underwaterPlatformInfoDd) {
			ProductCommonVo productCommonVo = new ProductCommonVo();
			productCommonVo.setName(underwaterPlatformInfoDd.getPlatformName());
			productCommonVo.setImage(underwaterPlatformInfoDd.getPlatformImg());
			List<ParametersVo> parametersVos = new ArrayList<>();
			//parametersVos.add(new ParametersVo("排水量", underwaterPlatformInfoDd.getDisplacement()));
			parametersVos.add(new ParametersVo("深度范围", underwaterPlatformInfoDd.getPlatformDepthRange()));
			parametersVos.add(new ParametersVo("子平台速度范围", underwaterPlatformInfoDd.getSubPlatformSpeedRange()));
			productCommonVo.setParameters(parametersVos);
			productCommonVos.add(productCommonVo);
		}

		QueryWrapper<TbVehicleInfoDd> vehicleInfoDdQueryWrapper = new QueryWrapper<>();
		vehicleInfoDdQueryWrapper.lambda().eq(TbVehicleInfoDd::getTrialId, trialId);

		TbVehicleInfoDd vehicleInfoDd = iTbVehicleInfoDdService.getOne(vehicleInfoDdQueryWrapper);
		if (null != vehicleInfoDd) {
			ProductCommonVo productCommonVo = new ProductCommonVo();
			productCommonVo.setName(vehicleInfoDd.getVehicleName());
			productCommonVo.setImage(vehicleInfoDd.getVehicleImage());
			List<ParametersVo> parametersVos = new ArrayList<>();
			String speed = "0";
			if (null != vehicleInfoDd.getSailingSpeed()) {
				speed = vehicleInfoDd.getSailingSpeed().toString();
			}
			//parametersVos.add(new ParametersVo("航线速度", speed));
			parametersVos.add(new ParametersVo("承载能力", vehicleInfoDd.getCarryingCapacity()));
			productCommonVo.setParameters(parametersVos);
			productCommonVos.add(productCommonVo);
		}

		QueryWrapper<TbFillingEquipmentInfoDd> fillingEquipmentInfoDdQueryWrapper = new QueryWrapper<>();
		fillingEquipmentInfoDdQueryWrapper.lambda().eq(TbFillingEquipmentInfoDd::getTrialId, trialId);

		TbFillingEquipmentInfoDd fillingEquipmentInfoDd = iTbFillingEquipmentInfoDdService.getOne(fillingEquipmentInfoDdQueryWrapper);
		if (null != fillingEquipmentInfoDd) {
			ProductCommonVo productCommonVo = new ProductCommonVo();
			productCommonVo.setName(fillingEquipmentInfoDd.getEquipmentName());
			productCommonVo.setImage(fillingEquipmentInfoDd.getEquipmentImage());
			List<ParametersVo> parametersVos = new ArrayList<>();
			//parametersVos.add(new ParametersVo("状态", fillingEquipmentInfoDd.getState()));
			parametersVos.add(new ParametersVo("长度", fillingEquipmentInfoDd.getLength()));
			parametersVos.add(new ParametersVo("直径", fillingEquipmentInfoDd.getDiameter()));
			parametersVos.add(new ParametersVo("重量", fillingEquipmentInfoDd.getWeight()));
			productCommonVo.setParameters(parametersVos);
			productCommonVos.add(productCommonVo);
		}

		QueryWrapper<TbFloatingCraneDd> floatingCraneDdQueryWrapper = new QueryWrapper<>();
		floatingCraneDdQueryWrapper.lambda().eq(TbFloatingCraneDd::getTrialId, trialId);

		TbFloatingCraneDd floatingCraneDd = iTbFloatingCraneDdService.getOne(floatingCraneDdQueryWrapper);
		if (null != floatingCraneDd) {
			ProductCommonVo productCommonVo = new ProductCommonVo();
			productCommonVo.setName(floatingCraneDd.getFloatingCraneName());
			productCommonVo.setImage(floatingCraneDd.getFloatingImage());
			List<ParametersVo> parametersVos = new ArrayList<>();
			parametersVos.add(new ParametersVo("臂长", floatingCraneDd.getArmLength()));
			parametersVos.add(new ParametersVo("额定能力", floatingCraneDd.getAbility()));
			productCommonVo.setParameters(parametersVos);
			productCommonVos.add(productCommonVo);
		}
		return new ResponseVo(productCommonVos);
	}


	@ApiOperation("产品基本信息接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectProductInfo")
	public ResponseVo selectProductInfo(@RequestBody @Valid ComQuery query) {
		List<ProductCommonVo> productCommonVos = new ArrayList<>();
		String trialId = query.getData().getTrialId();
		String ipAddr = query.getData().getIpAddr();
		if (StringUtils.isEmpty(trialId)) {
			TbTrialInformationDd trialInfoTrialId = getTrialInformationDd(trialId, ipAddr);
			trialId = trialInfoTrialId.getTrialId();
		}

		//平台信息
		QueryWrapper<TbUnderwaterPlatformInfoDd> underwaterPlatformInfoDdQueryWrapper = new QueryWrapper<>();
		underwaterPlatformInfoDdQueryWrapper.lambda().eq(TbUnderwaterPlatformInfoDd::getTrialId, trialId);
		TbUnderwaterPlatformInfoDd underwaterPlatformInfoDd = iTbUnderwaterPlatformInfoDdService.getOne(underwaterPlatformInfoDdQueryWrapper);
		if (null != underwaterPlatformInfoDd) {
			ProductCommonVo productCommonVo = new ProductCommonVo();
			productCommonVo.setName(underwaterPlatformInfoDd.getPlatformName());
			productCommonVo.setImage(underwaterPlatformInfoDd.getPlatformImg());
			List<ParametersVo> parametersVos = new ArrayList<>();
			//parametersVos.add(new ParametersVo("排水量", underwaterPlatformInfoDd.getDisplacement()));
			parametersVos.add(new ParametersVo("深度范围", underwaterPlatformInfoDd.getPlatformDepthRange()));
			parametersVos.add(new ParametersVo("子平台速度范围", underwaterPlatformInfoDd.getSubPlatformSpeedRange()));
			productCommonVo.setParameters(parametersVos);
			productCommonVos.add(productCommonVo);
		}

		QueryWrapper<TbVehicleInfoDd> vehicleInfoDdQueryWrapper = new QueryWrapper<>();
		vehicleInfoDdQueryWrapper.lambda().eq(TbVehicleInfoDd::getTrialId, trialId);

		TbVehicleInfoDd vehicleInfoDd = iTbVehicleInfoDdService.getOne(vehicleInfoDdQueryWrapper);
		if (null != vehicleInfoDd) {
			ProductCommonVo productCommonVo = new ProductCommonVo();
			productCommonVo.setName(vehicleInfoDd.getVehicleName());
			productCommonVo.setImage(vehicleInfoDd.getVehicleImage());
			List<ParametersVo> parametersVos = new ArrayList<>();
//			String speed = "0";
//			if (null != vehicleInfoDd.getSailingSpeed()) {
//				speed = vehicleInfoDd.getSailingSpeed().toString();
//			}
//			parametersVos.add(new ParametersVo("航线速度", speed));
			parametersVos.add(new ParametersVo("承载能力", vehicleInfoDd.getCarryingCapacity()));
			productCommonVo.setParameters(parametersVos);
			productCommonVos.add(productCommonVo);
		}

		QueryWrapper<TbFillingEquipmentInfoDd> fillingEquipmentInfoDdQueryWrapper = new QueryWrapper<>();
		fillingEquipmentInfoDdQueryWrapper.lambda().eq(TbFillingEquipmentInfoDd::getTrialId, trialId);

		TbFillingEquipmentInfoDd fillingEquipmentInfoDd = iTbFillingEquipmentInfoDdService.getOne(fillingEquipmentInfoDdQueryWrapper);
		if (null != fillingEquipmentInfoDd) {
			ProductCommonVo productCommonVo = new ProductCommonVo();
			productCommonVo.setName(fillingEquipmentInfoDd.getEquipmentName());
			productCommonVo.setImage(fillingEquipmentInfoDd.getEquipmentImage());
			List<ParametersVo> parametersVos = new ArrayList<>();
			parametersVos.add(new ParametersVo("长度", fillingEquipmentInfoDd.getLength()));
			parametersVos.add(new ParametersVo("直径", fillingEquipmentInfoDd.getDiameter()));
			parametersVos.add(new ParametersVo("重量", fillingEquipmentInfoDd.getWeight()));
			productCommonVo.setParameters(parametersVos);
			productCommonVos.add(productCommonVo);
		}

		QueryWrapper<TbFloatingCraneDd> floatingCraneDdQueryWrapper = new QueryWrapper<>();
		floatingCraneDdQueryWrapper.lambda().eq(TbFloatingCraneDd::getTrialId, trialId);

		TbFloatingCraneDd floatingCraneDd = iTbFloatingCraneDdService.getOne(floatingCraneDdQueryWrapper);
		if (null != floatingCraneDd) {
			ProductCommonVo productCommonVo = new ProductCommonVo();
			productCommonVo.setName(floatingCraneDd.getFloatingCraneName());
			productCommonVo.setImage(floatingCraneDd.getFloatingImage());
			List<ParametersVo> parametersVos = new ArrayList<>();
			parametersVos.add(new ParametersVo("臂长", floatingCraneDd.getArmLength()));
			parametersVos.add(new ParametersVo("额定能力", floatingCraneDd.getAbility()));
			productCommonVo.setParameters(parametersVos);
			productCommonVos.add(productCommonVo);
		}
		return new ResponseVo(productCommonVos);
	}


	@ApiOperation("转运车辆信息接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectTransferCar")
	public TransferCarVo selectTransferCar(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		TransferCarVo transferCarVo = new TransferCarVo();
//        transferCarVo.setVehicleId("1");
//        transferCarVo.setVehicleName("车辆转运名称1");
//        transferCarVo.setSailingSpeed("19");
//        transferCarVo.setCarryingCapacity("300");
//        transferCarVo.setVehicleImage("车辆转运名称1.PNG");
		return transferCarVo;
	}

	@ApiOperation("转运车辆实时接口(废弃，暂不使用)")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId",
		"query.data.vehicleId"
	})
	@PostMapping("/selectTransferRealCar")
	public ResponseVo selectTransferRealCar(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		String vehicleId = query.getData().getVehicleId();

		List<TransferRealCarVo> transferRealCarVos = new ArrayList<>();
		TransferRealCarVo transferCarVo1 = new TransferRealCarVo();
		TransferRealCarVo transferCarVo2 = new TransferRealCarVo();
		TransferRealCarVo transferCarVo3 = new TransferRealCarVo();
		TransferRealCarVo transferCarVo4 = new TransferRealCarVo();

		transferCarVo1.setRunningTime("14:00");
		transferCarVo1.setSpeedperhour("200");

		transferCarVo2.setRunningTime("15:00");
		transferCarVo2.setSpeedperhour("300");

		transferCarVo3.setRunningTime("16:00");
		transferCarVo3.setSpeedperhour("350");

		transferCarVo4.setRunningTime("17:00");
		transferCarVo4.setSpeedperhour("300");

		transferRealCarVos.add(transferCarVo1);
		transferRealCarVos.add(transferCarVo2);
		transferRealCarVos.add(transferCarVo3);
		transferRealCarVos.add(transferCarVo4);

		return new ResponseVo(transferRealCarVos);
	}

	/**
	 * 监控点位接口
	 *
	 * @return
	 */
	@ApiOperation("监控点位接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectMonitorPoints")
	public ResponseVo selectMonitorPoints(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		List<MonitorPointVo> monitorPointVos = new ArrayList<>();
		MonitorPointVo monitorPointVo1 = new MonitorPointVo();
		MonitorPointVo monitorPointVo2 = new MonitorPointVo();
		MonitorPointVo monitorPointVo3 = new MonitorPointVo();

		monitorPointVo1.setMonitorId("1");
		monitorPointVo1.setMonitorImage("视频1.MP4");
		monitorPointVo1.setMonitorName("监控视频1");
		monitorPointVo1.setMonitorState("正常");
		monitorPointVo1.setMonitorLongitude("123");
		monitorPointVo1.setMonitorLatitude("123");

		monitorPointVo2.setMonitorId("2");
		monitorPointVo2.setMonitorImage("视频2.MP4");
		monitorPointVo2.setMonitorName("监控视频2");
		monitorPointVo2.setMonitorState("正常");
		monitorPointVo2.setMonitorLongitude("123");
		monitorPointVo2.setMonitorLatitude("123");

		monitorPointVo3.setMonitorId("3");
		monitorPointVo3.setMonitorImage("视频3.MP4");
		monitorPointVo3.setMonitorName("监控视频3");
		monitorPointVo3.setMonitorState("正常");
		monitorPointVo3.setMonitorLongitude("123");
		monitorPointVo3.setMonitorLatitude("123");

		monitorPointVos.add(monitorPointVo1);
		monitorPointVos.add(monitorPointVo2);
		monitorPointVos.add(monitorPointVo3);

		return new ResponseVo(monitorPointVos);
	}


	@ApiOperation("装填设备信息接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectLoadEquipment")
	public LoadEquipmentVo selectLoadEquipment(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		LoadEquipmentVo loadEquipmentVo = new LoadEquipmentVo();
//        loadEquipmentVo.setEquipmentId("1");
//        loadEquipmentVo.setEquipmentName("装填设备名称");
//        loadEquipmentVo.setEquipmentImage("装填设备名称.PNG");
//        loadEquipmentVo.setDiameter("200");
//        loadEquipmentVo.setLength("100");
//        loadEquipmentVo.setWeight("300");
//        loadEquipmentVo.setState("正常");
		return loadEquipmentVo;
	}


	@ApiOperation("浮吊船只信息接口")
	@PostMapping("/selectFloatShip")
	public FloatShipVo selectFloatShip() {
		//        floatShipVo.setFloatingcraneId("1");
//        floatShipVo.setFloatingcraneName("测试浮吊船只");
//        floatShipVo.setAbility("300");
//        floatShipVo.setFloatingImage("测试浮吊船只.PNG");
//        floatShipVo.setState("正常");
		return new FloatShipVo();
	}


	@ApiOperation("重力锚信息接口")
	@PostMapping("/selectAnchor")
	public AnchorVo selectAnchor() {
		AnchorVo anchorVo = new AnchorVo();
		anchorVo.setAnchorId("1");
		anchorVo.setAnchorName("重力锚");
		anchorVo.setWeight("8");
		anchorVo.setAnchorImage("重力锚.PNG");
		return anchorVo;
	}


	@ApiOperation("综合保障船只信息接口")
	@PostMapping("/selectShipInfo")
	public ShipInfoVo selectShipInfo() {
		ShipInfoVo shipInfoVo = new ShipInfoVo();
		shipInfoVo.setShipsId("1");
		shipInfoVo.setShipsName("综合保障船只");
		shipInfoVo.setShipsImage("综合保障船只.PNG");
		shipInfoVo.setDraftCapacity("200");
		shipInfoVo.setState("正常");
		shipInfoVo.setPowerType("动力类型");
		shipInfoVo.setSpeedCapability("300");
		shipInfoVo.setShipsTypr("保障船只");
		return shipInfoVo;
	}


	@ApiOperation("船只实时接口")
	@PostMapping("/selectShipRealInfo")
	public ResponseVo selectShipRealInfo() {
		List<TransferRealCarVo> transferRealCarVos = new ArrayList<>();
		TransferRealCarVo transferCarVo1 = new TransferRealCarVo();
		TransferRealCarVo transferCarVo2 = new TransferRealCarVo();
		TransferRealCarVo transferCarVo3 = new TransferRealCarVo();
		TransferRealCarVo transferCarVo4 = new TransferRealCarVo();

		transferCarVo1.setRunningTime("14:00");
		transferCarVo1.setSpeedperhour("200");

		transferCarVo2.setRunningTime("15:00");
		transferCarVo2.setSpeedperhour("300");

		transferCarVo3.setRunningTime("16:00");
		transferCarVo3.setSpeedperhour("350");

		transferCarVo4.setRunningTime("17:00");
		transferCarVo4.setSpeedperhour("300");

		transferRealCarVos.add(transferCarVo1);
		transferRealCarVos.add(transferCarVo2);
		transferRealCarVos.add(transferCarVo3);
		transferRealCarVos.add(transferCarVo4);

		return new ResponseVo(transferRealCarVos);
	}


	@ApiOperation("转运阶段视频接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId",
		"query.data.stageId"
	})
	@PostMapping("/selectTransportVideo")
	public TransportVideoVo selectTransportVideo(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		String stageId = query.getData().getStageId();
		TransportVideoVo transportVideoVo = new TransportVideoVo();
		QueryWrapper<TbVideoDd> videoDdQueryWrapper = new QueryWrapper<>();
		videoDdQueryWrapper.lambda()
			.eq(TbVideoDd::getTrialId, trialId)
			.eq(!StringUtils.isEmpty(stageId), TbVideoDd::getStageId, stageId)
			.eq(TbVideoDd::getVideoId, CommonConstant.prepareVideoOne);

		TbVideoDd videoDd = iTbVideoDdService.getOne(videoDdQueryWrapper);
		if (null != videoDd) {
			transportVideoVo.setVideoId(videoDd.getVideoId());
			transportVideoVo.setVideoName(videoDd.getVideoName());
			transportVideoVo.setVideoUrl(videoDd.getVideoUrl());
		}
		return transportVideoVo;
	}


	@ApiOperation("事前准备阶段视频接口1")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId",
		"query.data.stageId"
	})
	@PostMapping("/selectPrepareVideoOne")
	public TransportVideoVo selectPrepareVideoOne(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		String stageId = query.getData().getStageId();
		TransportVideoVo transportVideoVo = new TransportVideoVo();
		QueryWrapper<TbVideoDd> videoDdQueryWrapper = new QueryWrapper<>();
		videoDdQueryWrapper.lambda()
			.eq(TbVideoDd::getTrialId, trialId)
			.eq(!StringUtils.isEmpty(stageId), TbVideoDd::getStageId, stageId)
			.eq(TbVideoDd::getVideoId, CommonConstant.prepareVideoTwo);

		TbVideoDd videoDd = iTbVideoDdService.getOne(videoDdQueryWrapper);
		if (null != videoDd) {
			transportVideoVo.setVideoId(videoDd.getVideoId());
			transportVideoVo.setVideoName(videoDd.getVideoName());
			transportVideoVo.setVideoUrl(videoDd.getVideoUrl());
		}
		return transportVideoVo;
	}


	@ApiOperation("事前准备阶段视频接口2")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId",
		"query.data.stageId"
	})
	@PostMapping("/selectPrepareVideoTwo")
	public TransportVideoVo selectPrepareVideoTwo(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		String stageId = query.getData().getStageId();
		TransportVideoVo transportVideoVo = new TransportVideoVo();
		QueryWrapper<TbVideoDd> videoDdQueryWrapper = new QueryWrapper<>();
		videoDdQueryWrapper.lambda()
			.eq(TbVideoDd::getTrialId, trialId)
			.eq(TbVideoDd::getStageId, stageId)
			.eq(TbVideoDd::getVideoId, CommonConstant.prepareVideoTwo);

		TbVideoDd videoDd = iTbVideoDdService.getOne(videoDdQueryWrapper);
		if (null != videoDd) {
			transportVideoVo.setVideoId(videoDd.getVideoId());
			transportVideoVo.setVideoName(videoDd.getVideoName());
			transportVideoVo.setVideoUrl(videoDd.getVideoUrl());
		}
		return transportVideoVo;
	}


	@ApiOperation("平台就位状态接口（实时）")
	@PostMapping("/selectPlatformStatus")
	public ResponseVo selectPlatformStatus() {
		List<PlatformStatusVo> platformStatusVos = new ArrayList<>();
		PlatformStatusVo platformStatusVo1 = new PlatformStatusVo();
		PlatformStatusVo platformStatusVo2 = new PlatformStatusVo();
		PlatformStatusVo platformStatusVo3 = new PlatformStatusVo();
		PlatformStatusVo platformStatusVo4 = new PlatformStatusVo();
		PlatformStatusVo platformStatusVo5 = new PlatformStatusVo();

		platformStatusVo1.setId("workMode");
		platformStatusVo1.setKey("0x01");
		platformStatusVo1.setValue("手动");
		platformStatusVo1.setColor("white");

		platformStatusVo2.setId("anchoringStatus");
		platformStatusVo2.setKey("0x00");
		platformStatusVo2.setValue("未开始");
		platformStatusVo2.setColor("grey");

		platformStatusVo3.setId("divingStatus");
		platformStatusVo3.setKey("0x01");
		platformStatusVo3.setValue("执行中");
		platformStatusVo3.setColor("yellow");

		platformStatusVo4.setId("levellingStatus");
		platformStatusVo4.setKey("0x11");
		platformStatusVo4.setValue("已完成");
		platformStatusVo4.setColor("green");

		platformStatusVo5.setId("floatingStatus");
		platformStatusVo5.setKey("0x00");
		platformStatusVo5.setValue("未开始");
		platformStatusVo5.setColor("grey");

		platformStatusVos.add(platformStatusVo1);
		platformStatusVos.add(platformStatusVo2);
		platformStatusVos.add(platformStatusVo3);
		platformStatusVos.add(platformStatusVo4);
		platformStatusVos.add(platformStatusVo5);

		return new ResponseVo(platformStatusVos);
	}


	@ApiOperation("保障系统信息-下拉框接口（实时）")
	@PostMapping("/selectGuaranteeSystem")
	public ResponseVo selectGuaranteeSystem() {
		List<GuaranteeSystemVo> guaranteeSystemVos = new ArrayList<>();
		GuaranteeSystemVo guaranteeSystemVo1 = new GuaranteeSystemVo();
		GuaranteeSystemVo guaranteeSystemVo2 = new GuaranteeSystemVo();
		GuaranteeSystemVo guaranteeSystemVo3 = new GuaranteeSystemVo();
		GuaranteeSystemVo guaranteeSystemVo4 = new GuaranteeSystemVo();
		GuaranteeSystemVo guaranteeSystemVo5 = new GuaranteeSystemVo();
		GuaranteeSystemVo guaranteeSystemVo6 = new GuaranteeSystemVo();
		GuaranteeSystemVo guaranteeSystemVo7 = new GuaranteeSystemVo();
		GuaranteeSystemVo guaranteeSystemVo8 = new GuaranteeSystemVo();
		GuaranteeSystemVo guaranteeSystemVo9 = new GuaranteeSystemVo();
		GuaranteeSystemVo guaranteeSystemVo10 = new GuaranteeSystemVo();
		GuaranteeSystemVo guaranteeSystemVo11 = new GuaranteeSystemVo();

		List<GuaranteeSystemListVo> guarantList1 = new ArrayList<>();
		List<GuaranteeSystemListVo> guarantList2 = new ArrayList<>();
		List<GuaranteeSystemListVo> guarantList3 = new ArrayList<>();
		List<GuaranteeSystemListVo> guarantList4 = new ArrayList<>();
		List<GuaranteeSystemListVo> guarantList5 = new ArrayList<>();
		List<GuaranteeSystemListVo> guarantList6 = new ArrayList<>();
		List<GuaranteeSystemListVo> guarantList7 = new ArrayList<>();
		List<GuaranteeSystemListVo> guarantList8 = new ArrayList<>();
		List<GuaranteeSystemListVo> guarantList9 = new ArrayList<>();
		List<GuaranteeSystemListVo> guarantList10 = new ArrayList<>();
		List<GuaranteeSystemListVo> guarantList11 = new ArrayList<>();

		for (int i = 0; i < 10; i++) {
			GuaranteeSystemListVo guaranteeSystemListVo1 = new GuaranteeSystemListVo();
			guaranteeSystemListVo1.setKeyElement(i + "#组高压空气气瓶压力");
			guaranteeSystemListVo1.setCurrentParam("33MPa");
			if (i % 2 == 0) {
				guaranteeSystemListVo1.setCurrentParamColor("red");
			} else {
				guaranteeSystemListVo1.setCurrentParamColor("yellow");
			}
			guarantList1.add(guaranteeSystemListVo1);
		}

		for (int i = 0; i < 10; i++) {
			GuaranteeSystemListVo guaranteeSystemListVo1 = new GuaranteeSystemListVo();
			guaranteeSystemListVo1.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemListVo1.setCurrentParam("33T");
			if (i % 2 == 0) {
				guaranteeSystemListVo1.setCurrentParamColor("red");
			} else {
				guaranteeSystemListVo1.setCurrentParamColor("yellow");
			}
			guarantList2.add(guaranteeSystemListVo1);
		}

		guaranteeSystemVo1.setGuarantKey("1");
		guaranteeSystemVo1.setGuarantValue("高压气瓶气压");
		guaranteeSystemVo1.setGuarantList(guarantList1);

		guaranteeSystemVo2.setGuarantKey("2");
		guaranteeSystemVo2.setGuarantValue("水舱水量");
		guaranteeSystemVo2.setGuarantList(guarantList2);

		guaranteeSystemVo3.setGuarantKey("3");
		guaranteeSystemVo3.setGuarantValue("二氧化碳浓度");
		guaranteeSystemVo3.setGuarantList(guarantList3);

		guaranteeSystemVo4.setGuarantKey("4");
		guaranteeSystemVo4.setGuarantValue("氧气浓度");
		guaranteeSystemVo4.setGuarantList(guarantList4);

		guaranteeSystemVo5.setGuarantKey("5");
		guaranteeSystemVo5.setGuarantValue("氢气浓度");
		guaranteeSystemVo5.setGuarantList(guarantList5);

		guaranteeSystemVo6.setGuarantKey("6");
		guaranteeSystemVo6.setGuarantValue("空气温度");
		guaranteeSystemVo6.setGuarantList(guarantList6);

		guaranteeSystemVo7.setGuarantKey("7");
		guaranteeSystemVo7.setGuarantValue("空气湿度");
		guaranteeSystemVo7.setGuarantList(guarantList7);

		guaranteeSystemVo8.setGuarantKey("8");
		guaranteeSystemVo8.setGuarantValue("系统压力");
		guaranteeSystemVo8.setGuarantList(guarantList8);

		guaranteeSystemVo9.setGuarantKey("9");
		guaranteeSystemVo9.setGuarantValue("系统油温");
		guaranteeSystemVo9.setGuarantList(guarantList9);

		guaranteeSystemVo10.setGuarantKey("10");
		guaranteeSystemVo10.setGuarantValue("系统液位");
		guaranteeSystemVo10.setGuarantList(guarantList10);

		guaranteeSystemVo11.setGuarantKey("11");
		guaranteeSystemVo11.setGuarantValue("液压泵启停状态");
		guaranteeSystemVo11.setGuarantList(guarantList11);

		guaranteeSystemVos.add(guaranteeSystemVo1);
		guaranteeSystemVos.add(guaranteeSystemVo2);
		guaranteeSystemVos.add(guaranteeSystemVo3);
		guaranteeSystemVos.add(guaranteeSystemVo4);
		guaranteeSystemVos.add(guaranteeSystemVo5);
		guaranteeSystemVos.add(guaranteeSystemVo6);
		guaranteeSystemVos.add(guaranteeSystemVo7);
		guaranteeSystemVos.add(guaranteeSystemVo8);
		guaranteeSystemVos.add(guaranteeSystemVo9);
		guaranteeSystemVos.add(guaranteeSystemVo10);
		guaranteeSystemVos.add(guaranteeSystemVo11);

		return new ResponseVo(guaranteeSystemVos);
	}


	@ApiOperation(" 保障系统信息-列表接口（实时）")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.guarantId"
	})
	@PostMapping("/selectGuaranteeSystemList")
	public ResponseVo selectGuaranteeSystemList(@RequestBody @Valid ComQuery query) {
		String guarantId = query.getData().getGuarantId();
		List<GuaranteeSystemListVo> guaranteeSystemListVos = new ArrayList<>();
		GuaranteeSystemListVo guaranteeSystemVo1 = new GuaranteeSystemListVo();
		GuaranteeSystemListVo guaranteeSystemVo2 = new GuaranteeSystemListVo();
		GuaranteeSystemListVo guaranteeSystemVo3 = new GuaranteeSystemListVo();
		GuaranteeSystemListVo guaranteeSystemVo4 = new GuaranteeSystemListVo();
		GuaranteeSystemListVo guaranteeSystemVo5 = new GuaranteeSystemListVo();
		GuaranteeSystemListVo guaranteeSystemVo6 = new GuaranteeSystemListVo();
		GuaranteeSystemListVo guaranteeSystemVo7 = new GuaranteeSystemListVo();
		GuaranteeSystemListVo guaranteeSystemVo8 = new GuaranteeSystemListVo();
		GuaranteeSystemListVo guaranteeSystemVo9 = new GuaranteeSystemListVo();
		GuaranteeSystemListVo guaranteeSystemVo10 = new GuaranteeSystemListVo();
		GuaranteeSystemListVo guaranteeSystemVo11 = new GuaranteeSystemListVo();

		if (StringUtils.isNotEmpty(guarantId) && guarantId.equalsIgnoreCase("1")) {
			guaranteeSystemVo1.setKeyElement("1#组高压空气气瓶压力");
			guaranteeSystemVo1.setCurrentParam("33MPa");

			guaranteeSystemVo2.setKeyElement("2#组高压空气气瓶压力");
			guaranteeSystemVo2.setCurrentParam("30MPa");

			guaranteeSystemVo3.setKeyElement("3#组高压空气气瓶压力");
			guaranteeSystemVo3.setCurrentParam("33MPa");

			guaranteeSystemVo4.setKeyElement("4#组高压空气气瓶压力");
			guaranteeSystemVo4.setCurrentParam("33MPa");

			guaranteeSystemVo5.setKeyElement("5#组高压空气气瓶压力");
			guaranteeSystemVo5.setCurrentParam("33MPa");

			guaranteeSystemVo6.setKeyElement("6#组高压空气气瓶压力");
			guaranteeSystemVo6.setCurrentParam("33MPa");

			guaranteeSystemVo7.setKeyElement("7#组高压空气气瓶压力");
			guaranteeSystemVo7.setCurrentParam("33MPa");

			guaranteeSystemVo8.setKeyElement("8#组高压空气气瓶压力");
			guaranteeSystemVo8.setCurrentParam("33MPa");

			guaranteeSystemVo9.setKeyElement("9#组高压空气气瓶压力");
			guaranteeSystemVo9.setCurrentParam("33MPa");

			guaranteeSystemVo10.setKeyElement("10#组高压空气气瓶压力");
			guaranteeSystemVo10.setCurrentParam("33MPa");

			guaranteeSystemVo11.setKeyElement("11#组高压空气气瓶压力");
			guaranteeSystemVo11.setCurrentParam("33MPa");
		} else if (StringUtils.isNotEmpty(guarantId) && guarantId.equalsIgnoreCase("2")) {
			guaranteeSystemVo1.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo1.setCurrentParam("33T");

			guaranteeSystemVo2.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo2.setCurrentParam("33T");

			guaranteeSystemVo3.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo3.setCurrentParam("33T");

			guaranteeSystemVo4.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo4.setCurrentParam("33T");

			guaranteeSystemVo5.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo5.setCurrentParam("33T");

			guaranteeSystemVo6.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo6.setCurrentParam("33T");

			guaranteeSystemVo7.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo7.setCurrentParam("33T");

			guaranteeSystemVo8.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo8.setCurrentParam("33T");

			guaranteeSystemVo9.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo9.setCurrentParam("33T");

			guaranteeSystemVo10.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo10.setCurrentParam("33T");

			guaranteeSystemVo11.setKeyElement("左舷艏部纵倾平衡水舱水量");
			guaranteeSystemVo11.setCurrentParam("33T");
		}

		guaranteeSystemListVos.add(guaranteeSystemVo1);
		guaranteeSystemListVos.add(guaranteeSystemVo2);
		guaranteeSystemListVos.add(guaranteeSystemVo3);
		guaranteeSystemListVos.add(guaranteeSystemVo4);
		guaranteeSystemListVos.add(guaranteeSystemVo5);
		guaranteeSystemListVos.add(guaranteeSystemVo6);
		guaranteeSystemListVos.add(guaranteeSystemVo7);
		guaranteeSystemListVos.add(guaranteeSystemVo8);
		guaranteeSystemListVos.add(guaranteeSystemVo9);
		guaranteeSystemListVos.add(guaranteeSystemVo10);
		guaranteeSystemListVos.add(guaranteeSystemVo11);

		return new ResponseVo(guaranteeSystemListVos);
	}


	@ApiOperation("承载平台数据接口（实时）")
	@PostMapping("/selectLoadPlatform")
	public ResponseVo selectLoadPlatform() {
		List<LoadPlatformVo> guaranteeSystemVos = new ArrayList<>();
		LoadPlatformVo loadPlatformVo1 = new LoadPlatformVo();
		LoadPlatformVo loadPlatformVo2 = new LoadPlatformVo();

		loadPlatformVo1.setParentName("惯导速度");
		loadPlatformVo1.setDefaultSelect(true);

		List<ChildTypesVo> childTypesVos1 = new ArrayList<>();
		ChildTypesVo childTypesVo1 = new ChildTypesVo();
		ChildTypesVo childTypesVo2 = new ChildTypesVo();
		ChildTypesVo childTypesVo3 = new ChildTypesVo();

		childTypesVo1.setChildName("东向速度");
		childTypesVo1.setDefaultSelect(true);
		List<ChildListVo> childListVos1 = new ArrayList<>();
		for (int i = 0; i <= 100; i++) {
			Random rd = new Random();
			Integer num = rd.nextInt(300) + 1;  //1到300随机值
			Date date = new Date();
			ChildListVo childListVo1 = new ChildListVo();
			childListVo1.setNumerValue(num.toString());
			childListVo1.setTimeValue(simpleDateFormat.format(date));
			childListVos1.add(childListVo1);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		childTypesVo1.setChildList(childListVos1);
		childTypesVos1.add(childTypesVo1);

		childTypesVo2.setChildName("北向速度");
		childTypesVo2.setDefaultSelect(false);
		List<ChildListVo> childListVos2 = new ArrayList<>();
		for (int i = 0; i <= 100; i++) {
			Random rd = new Random();
			Integer num = rd.nextInt(300) + 1;  //1到300随机值
			Date date = new Date();
			ChildListVo childListVo2 = new ChildListVo();
			childListVo2.setNumerValue(num.toString());
			childListVo2.setTimeValue(simpleDateFormat.format(date));
			childListVos2.add(childListVo2);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		childTypesVo2.setChildList(childListVos2);
		childTypesVos1.add(childTypesVo2);

		childTypesVo3.setChildName("深沉速度");
		childTypesVo3.setDefaultSelect(false);
		List<ChildListVo> childListVos3 = new ArrayList<>();
		for (int i = 0; i <= 100; i++) {
			Random rd = new Random();
			Integer num = rd.nextInt(300) + 1;  //1到300随机值
			Date date = new Date();
			ChildListVo childListVo3 = new ChildListVo();
			childListVo3.setNumerValue(num.toString());
			childListVo3.setTimeValue(simpleDateFormat.format(date));
			childListVos2.add(childListVo3);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		childTypesVo3.setChildList(childListVos3);
		childTypesVos1.add(childTypesVo3);
		loadPlatformVo1.setChildTypes(childTypesVos1);

		loadPlatformVo2.setParentName("惯导姿态角");
		loadPlatformVo2.setDefaultSelect(false);

		List<ChildTypesVo> childTypesVos2 = new ArrayList<>();
		ChildTypesVo childTypesVo21 = new ChildTypesVo();
		ChildTypesVo childTypesVo22 = new ChildTypesVo();

		childTypesVo21.setChildName("横滚角");
		childTypesVo21.setDefaultSelect(true);
		List<ChildListVo> childListVos21 = new ArrayList<>();
		for (int i = 0; i <= 100; i++) {
			Random rd = new Random();
			Integer num = rd.nextInt(300) + 1;  //1到300随机值
			Date date = new Date();
			ChildListVo childListVo3 = new ChildListVo();
			childListVo3.setNumerValue(num.toString());
			childListVo3.setTimeValue(simpleDateFormat.format(date));
			childListVos21.add(childListVo3);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		childTypesVo21.setUpperLimit("300");
		childTypesVo21.setDownLimit("100");
		childTypesVo21.setChildList(childListVos21);

		childTypesVo22.setChildName("俯仰角");
		childTypesVo22.setDefaultSelect(false);
		childTypesVo22.setChildList(null);

		childTypesVos2.add(childTypesVo21);
		childTypesVos2.add(childTypesVo22);
		loadPlatformVo2.setChildTypes(childTypesVos2);

		guaranteeSystemVos.add(loadPlatformVo1);
		guaranteeSystemVos.add(loadPlatformVo2);
		return new ResponseVo(guaranteeSystemVos);
	}

	@ApiOperation("环境接口（实时）")
	@PostMapping("/selectEnvironment")
	public ResponseVo selectEnvironment() {
		List<LoadPlatformVo> guaranteeSystemVos = new ArrayList<>();
		LoadPlatformVo loadPlatformVo1 = new LoadPlatformVo();
		LoadPlatformVo loadPlatformVo2 = new LoadPlatformVo();
		LoadPlatformVo loadPlatformVo3 = new LoadPlatformVo();

		loadPlatformVo1.setParentName("水流");

		List<ChildTypesVo> childTypesVos1 = new ArrayList<>();
		ChildTypesVo childTypesVo1 = new ChildTypesVo();

		childTypesVo1.setChildName("设备一");
		List<ChildListVo> childListVos1 = new ArrayList<>();
		for (int i = 0; i <= 10; i++) {
			Random rd = new Random();
			Integer num = rd.nextInt(300) + 1;  //1到300随机值
			Date date = new Date();
			ChildListVo childListVo1 = new ChildListVo();
			childListVo1.setNumerValue(num.toString());
			childListVo1.setTimeValue(simpleDateFormat.format(date));
			childListVos1.add(childListVo1);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		childTypesVo1.setChildList(childListVos1);
		childTypesVos1.add(childTypesVo1);
		loadPlatformVo1.setChildTypes(childTypesVos1);

		loadPlatformVo2.setParentName("水压");
		loadPlatformVo2.setDefaultSelect(false);

		List<ChildTypesVo> childTypesVos2 = new ArrayList<>();
		ChildTypesVo childTypesVo21 = new ChildTypesVo();

		childTypesVo21.setChildName("设备一");
		childTypesVo21.setDefaultSelect(true);
		List<ChildListVo> childListVos21 = new ArrayList<>();
		for (int i = 0; i <= 10; i++) {
			Random rd = new Random();
			Integer num = rd.nextInt(300) + 1;  //1到300随机值
			Date date = new Date();
			ChildListVo childListVo3 = new ChildListVo();
			childListVo3.setNumerValue(num.toString());
			childListVo3.setTimeValue(simpleDateFormat.format(date));
			childListVos21.add(childListVo3);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		childTypesVo21.setChildList(childListVos21);

		childTypesVos2.add(childTypesVo21);
		loadPlatformVo2.setChildTypes(childTypesVos2);

		loadPlatformVo3.setParentName("波浪");
		loadPlatformVo3.setWave("6");

		guaranteeSystemVos.add(loadPlatformVo1);
		guaranteeSystemVos.add(loadPlatformVo2);
		guaranteeSystemVos.add(loadPlatformVo3);
		return new ResponseVo(guaranteeSystemVos);
	}

	@ApiOperation("模型弹接口（实时）")
	@PostMapping("/selectModelBomb")
	public ResponseVo selectModelBomb() {
		List<LoadPlatformVo> guaranteeSystemVos = new ArrayList<>();
		LoadPlatformVo loadPlatformVo1 = new LoadPlatformVo();
		LoadPlatformVo loadPlatformVo2 = new LoadPlatformVo();
		LoadPlatformVo loadPlatformVo3 = new LoadPlatformVo();

		loadPlatformVo1.setParentName("姿态角");

		List<ChildTypesVo> childTypesVos1 = new ArrayList<>();
		ChildTypesVo childTypesVo1 = new ChildTypesVo();
		ChildTypesVo childTypesVo2 = new ChildTypesVo();

		childTypesVo1.setChildName("横滚角");
		childTypesVo1.setDefaultSelect(true);
		List<ChildListVo> childListVos1 = new ArrayList<>();
		for (int i = 0; i <= 10; i++) {
			Random rd = new Random();
			Integer num = rd.nextInt(300) + 1;  //1到300随机值
			Date date = new Date();
			ChildListVo childListVo1 = new ChildListVo();
			childListVo1.setNumerValue(num.toString());
			childListVo1.setTimeValue(simpleDateFormat.format(date));
			childListVos1.add(childListVo1);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		childTypesVo1.setChildList(childListVos1);
		childTypesVos1.add(childTypesVo1);

		childTypesVo2.setChildName("俯仰角");
		childTypesVo2.setDefaultSelect(false);
		List<ChildListVo> childListVos2 = new ArrayList<>();
		for (int i = 0; i <= 10; i++) {
			Random rd = new Random();
			Integer num = rd.nextInt(300) + 1;  //1到300随机值
			Date date = new Date();
			ChildListVo childListVo2 = new ChildListVo();
			childListVo2.setNumerValue(num.toString());
			childListVo2.setTimeValue(simpleDateFormat.format(date));
			childListVos2.add(childListVo2);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		childTypesVo2.setChildList(childListVos2);
		childTypesVos1.add(childTypesVo2);
		loadPlatformVo1.setChildTypes(childTypesVos1);

		loadPlatformVo2.setParentName("高度");

		List<ChildTypesVo> childTypesVos2 = new ArrayList<>();
		ChildTypesVo childTypesVo21 = new ChildTypesVo();

		List<ChildListVo> childListVos21 = new ArrayList<>();
		for (int i = 0; i <= 10; i++) {
			Random rd = new Random();
			Integer num = rd.nextInt(300) + 1;  //1到300随机值
			Date date = new Date();
			ChildListVo childListVo3 = new ChildListVo();
			childListVo3.setNumerValue(num.toString());
			childListVo3.setTimeValue(simpleDateFormat.format(date));
			childListVos21.add(childListVo3);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		childTypesVo21.setChildList(childListVos21);

		childTypesVos2.add(childTypesVo21);
		loadPlatformVo2.setChildTypes(childTypesVos2);

		loadPlatformVo3.setParentName("速度");

		List<ChildTypesVo> childTypesVos3 = new ArrayList<>();
		ChildTypesVo childTypesVo31 = new ChildTypesVo();

		List<ChildListVo> childListVos31 = new ArrayList<>();
		for (int i = 0; i <= 10; i++) {
			Random rd = new Random();
			Integer num = rd.nextInt(300) + 1;  //1到300随机值
			Date date = new Date();
			ChildListVo childListVo3 = new ChildListVo();
			childListVo3.setNumerValue(num.toString());
			childListVo3.setTimeValue(simpleDateFormat.format(date));
			childListVos31.add(childListVo3);
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		childTypesVo31.setChildList(childListVos31);

		childTypesVos3.add(childTypesVo31);
		loadPlatformVo3.setChildTypes(childTypesVos3);

		guaranteeSystemVos.add(loadPlatformVo1);
		guaranteeSystemVos.add(loadPlatformVo2);
		guaranteeSystemVos.add(loadPlatformVo3);
		return new ResponseVo(guaranteeSystemVos);
	}


	@ApiOperation("获取吸力锚信息")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectSuctionAnchorInfo")
	public ResponseVo selectSuctionAnchorInfo(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		List<SuctionAnchorVo> suctionAnchorVos = new ArrayList<>();
		//如果trialId为空就获取最新的试验id
		if (StringUtils.isEmpty(trialId)) {
			trialId = getTrialId();
		}
		QueryWrapper<TbAnchorDd> anchorDdQueryWrapper = new QueryWrapper<>();
		anchorDdQueryWrapper.lambda().eq(TbAnchorDd::getTrialId, trialId)
			.eq(TbAnchorDd::getAnchorType, CommonConstant.suctionAnchor);
		List<TbAnchorDd> anchorDds = iTbAnchorDdService.list(anchorDdQueryWrapper);
		if (null != anchorDds && anchorDds.size() > 0) {
			anchorDds.stream().forEach(p -> {
				SuctionAnchorVo suctionAnchorVo = new SuctionAnchorVo();
				suctionAnchorVo.setAnchorName(p.getAnchorName());
				suctionAnchorVo.setAnchorStates(p.getAnchorStates());
				suctionAnchorVo.setAnchorType(p.getAnchorType());
				suctionAnchorVo.setLat(p.getLat());
				suctionAnchorVo.setLon(p.getLon());
				suctionAnchorVo.setAttach(p.getAttach());
				suctionAnchorVos.add(suctionAnchorVo);
			});
		}
		return new ResponseVo(suctionAnchorVos);
	}

	@ApiOperation("获取吸力锚信息（仿真）")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectSuctionAnchorInfoSimulation")
	public ResponseVo selectSuctionAnchorInfoSimulation(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		List<SuctionAnchorVo> suctionAnchorVos = new ArrayList<>();
		//如果trialId为空就获取最新的试验id
		/*TbTrialInformationDd trialInformationDd = getTrialInfoSimulation(trialId);
		if (ObjectUtil.isEmpty(trialInformationDd)) {
			return new ResponseVo(suctionAnchorVos);
		}
		trialId = trialInformationDd.getTrialId();*/
		if (ObjectUtil.isEmpty(trialId)) {
			trialId = getTrialIdSimulation();
		}

		QueryWrapper<TbAnchorDd> anchorDdQueryWrapper = new QueryWrapper<>();
		anchorDdQueryWrapper.lambda().eq(TbAnchorDd::getTrialId, trialId)
			.eq(TbAnchorDd::getAnchorType, CommonConstant.suctionAnchor);
		List<TbAnchorDd> anchorDds = iTbAnchorDdService.list(anchorDdQueryWrapper);
		if (null != anchorDds && anchorDds.size() > 0) {
			anchorDds.stream().forEach(p -> {
				SuctionAnchorVo suctionAnchorVo = new SuctionAnchorVo();
				suctionAnchorVo.setAnchorName(p.getAnchorName());
				suctionAnchorVo.setAnchorStates(p.getAnchorStates());
				suctionAnchorVo.setAnchorType(p.getAnchorType());
				suctionAnchorVo.setLat(p.getLat());
				suctionAnchorVo.setLon(p.getLon());
				suctionAnchorVo.setAttach(p.getAttach());
				suctionAnchorVos.add(suctionAnchorVo);
			});
		}
		return new ResponseVo(suctionAnchorVos);
	}


	@ApiOperation("回放---切阶段接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendCutPhase")
	public CutPhaseVo sendCutPhase(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		CutPhaseVo cutPhaseVo = new CutPhaseVo();
		//开始时间
		QueryWrapper<TbSystemTtagerecordDd> QueryWrapperStartTime = new QueryWrapper<>();
		QueryWrapperStartTime.lambda().eq(TbSystemTtagerecordDd::getTrialId, trialId)
			.eq(TbSystemTtagerecordDd::getCommandId, CommonConstant.testPreparationCommandId);
		List<TbSystemTtagerecordDd> systemTtagerecordDdsStartTime = iTbSystemTtagerecordDdService.list(QueryWrapperStartTime).stream().sorted(Comparator.comparing(TbSystemTtagerecordDd::getTime)).collect(Collectors.toList());
		if (systemTtagerecordDdsStartTime.size() > 0) {
			TbSystemTtagerecordDd systemTtagerecordDd = systemTtagerecordDdsStartTime.get(0);
			cutPhaseVo.setStartTime(simpleDateFormat.format(systemTtagerecordDd.getTime()));
		}

		//结束时间
		QueryWrapper<TbSystemTtagerecordDd> QueryWrapperEndTime = new QueryWrapper<>();
		QueryWrapperEndTime.lambda().eq(TbSystemTtagerecordDd::getTrialId, trialId)
			.eq(TbSystemTtagerecordDd::getCommandId, CommonConstant.platformRecyclingEndCommandId);
		List<TbSystemTtagerecordDd> systemTtagerecordDdsEndTime = iTbSystemTtagerecordDdService.list(QueryWrapperEndTime).stream().sorted(Comparator.comparing(TbSystemTtagerecordDd::getTime).reversed()).collect(Collectors.toList());
		if (systemTtagerecordDdsEndTime.size() > 0) {
			TbSystemTtagerecordDd systemTtagerecordDd = systemTtagerecordDdsEndTime.get(0);
			cutPhaseVo.setEndTime(simpleDateFormat.format(systemTtagerecordDd.getTime()));
		}

		//构建具体指令
		//构建试前准备阶段
		this.getCutPhaseVo(trialId, CommonConstant.testPreparation, CommonConstant.testPreparationCommandId, cutPhaseVo.getList());

		//构建产品转运阶段
		this.getCutPhaseVo(trialId, CommonConstant.producttransfer, CommonConstant.producttransferCommandId, cutPhaseVo.getList());

		//构建产品装填阶段
		this.getCutPhaseVo(trialId, CommonConstant.productFilling, CommonConstant.productFillingCommandId, cutPhaseVo.getList());

		//构建平台就位阶段
		this.getCutPhaseVo(trialId, CommonConstant.platformInPlace, CommonConstant.platformInPlaceCommandId, cutPhaseVo.getList());

		//构建出筒运动阶段
		this.getCutPhaseVo(trialId, CommonConstant.motorPhase, CommonConstant.motorPhaseCommandId, cutPhaseVo.getList());

		//构建产品打捞阶段
		this.getCutPhaseVo(trialId, CommonConstant.productSalvage, CommonConstant.productSalvageCommandId, cutPhaseVo.getList());

		//构建平台回收阶段
		this.getCutPhaseVo(trialId, CommonConstant.platformRecycling, CommonConstant.platformRecyclingCommandId, cutPhaseVo.getList());

		return cutPhaseVo;
	}

	private void getCutPhaseVo(String trialId, String stageId, String commandId, List<InstructCommandNewVo> list) {
		QueryWrapper<TbSystemTtagerecordDd> QueryWrapper = new QueryWrapper<>();
		QueryWrapper.lambda().eq(TbSystemTtagerecordDd::getTrialId, trialId)
			.eq(TbSystemTtagerecordDd::getStageId, stageId)
			.eq(TbSystemTtagerecordDd::getCommandId, commandId);
		List<TbSystemTtagerecordDd> systemTtagerecordDds = iTbSystemTtagerecordDdService.list(QueryWrapper).stream().sorted(Comparator.comparing(TbSystemTtagerecordDd::getTime)).collect(Collectors.toList());
		if (systemTtagerecordDds.size() > 0) {
			TbSystemTtagerecordDd systemTtagerecordDd = systemTtagerecordDds.get(0);
			list.add(new InstructCommandNewVo(systemTtagerecordDd.getCommand(), null == systemTtagerecordDd.getStageKey() ? "" : systemTtagerecordDd.getStageKey().toString(), simpleDateFormat.format(systemTtagerecordDd.getTime())));
		}
	}


	@ApiOperation(" 回放---所有动画调用接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendAnimation")
	public List<InstructCommandNewVo> sendAnimation(@RequestBody @Valid ComQuery query) {
		String trialId = query.getData().getTrialId();
		if ("51".equals(trialId)) {
			List result = JSONObject.parseArray("[\n" +
				"    {" +
				"        \"commandValue\": \"sequenceState\",\n" +
				"        \"stageKey\": \"1\",\n" +
				"        \"time\": \"2022-11-28 14:35:00 000\"\n" +
				"    },\n" +
				"    {\n" +
				"        \"commandValue\": \"sequenceState\",\n" +
				"        \"stageKey\": \"2\",\n" +
				"        \"time\": \"2022-11-28 14:35:20 000\"\n" +
				"    },\n" +
				"    {\n" +
				"        \"commandValue\": \"sequenceState\",\n" +
				"        \"stageKey\": \"3\",\n" +
				"        \"time\": \"2022-11-28 14:37:00 000\"\n" +
				"    },\n" +
				"    {\n" +
				"        \"commandValue\": \"mountState\",\n" +
				"        \"stageKey\": \"1\",\n" +
				"        \"time\": \"2022-11-28 14:38:00 000\"\n" +
				"    },\n" +
				"    {\n" +
				"        \"commandValue\": \"anchorState\",\n" +
				"        \"stageKey\": \"3\",\n" +
				"        \"time\": \"2022-11-28 14:39:00 000\"\n" +
				"    },\n" +
				"    {\n" +
				"        \"commandValue\": \"anchorState\",\n" +
				"        \"stageKey\": \"4\",\n" +
				"        \"time\": \"2022-11-28 14:41:00 000\"\n" +
				"    },\n" +
				"    {\n" +
				"        \"commandValue\": \"mountState\",\n" +
				"        \"stageKey\": \"2\",\n" +
				"        \"time\": \"2022-11-28 14:42:00 000\"\n" +
				"    },\n" +
				"    {\n" +
				"        \"commandValue\": \"sequenceState\",\n" +
				"        \"stageKey\": \"6\",\n" +
				"        \"time\": \"2022-11-28 14:43:00 000\"\n" +
				"    },\n" +
				"    {\n" +
				"        \"commandValue\": \"sequenceState\",\n" +
				"        \"stageKey\": \"7\",\n" +
				"        \"time\": \"2022-11-28 14:45:00 000\"\n" +
				"    }\n" +
				"]");

			return result;
		}
		List<InstructCommandNewVo> instructCommandNewVos = new ArrayList<>();
		//构建具体指令
		//构建产品转运阶段
		this.getAnimation(trialId, CommonConstant.producttransfer, 2, CommonConstant.sequenceState, instructCommandNewVos);

		//构建产品装填阶段
		this.getAnimation(trialId, CommonConstant.productFilling, 3, CommonConstant.sequenceState, instructCommandNewVos);

		//构建平台就位阶段
		//平台挂载
		this.getAnimation(trialId, CommonConstant.platformInPlace, 1, CommonConstant.mountState, instructCommandNewVos);
		//部署吸力锚
		this.getAnimation(trialId, CommonConstant.platformInPlace, 3, CommonConstant.anchorState, instructCommandNewVos);
		//部署重力锚
		this.getAnimation(trialId, CommonConstant.platformInPlace, 4, CommonConstant.anchorState, instructCommandNewVos);
		//平台释放
		this.getAnimation(trialId, CommonConstant.platformInPlace, 0, CommonConstant.mountState, instructCommandNewVos);

		//构建产品打捞阶段
		this.getAnimation(trialId, CommonConstant.productSalvage, 7, CommonConstant.sequenceState, instructCommandNewVos);

		//构建平台回收阶段
		//收吸力锚
		this.getAnimation(trialId, CommonConstant.platformRecycling, 6, CommonConstant.sequenceState, instructCommandNewVos);
		//收重力锚
		this.getAnimation(trialId, CommonConstant.platformRecycling, 6, CommonConstant.anchorState, instructCommandNewVos);
		//平台挂载
		this.getAnimation(trialId, CommonConstant.platformRecycling, 2, CommonConstant.mountState, instructCommandNewVos);

		return instructCommandNewVos;
	}

	private void getAnimation(String trialId, String stageId, Integer stageKey, String
		commandId, List<InstructCommandNewVo> list) {
		QueryWrapper<TbSystemTtagerecordDd> QueryWrapper = new QueryWrapper<>();
		QueryWrapper.lambda().eq(TbSystemTtagerecordDd::getTrialId, trialId)
			.eq(TbSystemTtagerecordDd::getStageId, stageId)
			.eq(TbSystemTtagerecordDd::getStageKey, stageKey)
			.eq(TbSystemTtagerecordDd::getCommand, commandId);
		List<TbSystemTtagerecordDd> systemTtagerecordDds = iTbSystemTtagerecordDdService.list(QueryWrapper).stream().sorted(Comparator.comparing(TbSystemTtagerecordDd::getTime)).collect(Collectors.toList());
		if (systemTtagerecordDds.size() > 0) {
			TbSystemTtagerecordDd systemTtagerecordDd = systemTtagerecordDds.get(0);
			list.add(new InstructCommandNewVo(systemTtagerecordDd.getCommand(), null == systemTtagerecordDd.getStageKey() ? "" : systemTtagerecordDd.getStageKey().toString(), simpleDateFormat.format(systemTtagerecordDd.getTime())));
		}
	}

}
